Answer the question
In order to leave comments, you need to log in
How to setup ubuntu+apache2+python bundle?
Suggest good resources on this topic. New to Linux, and generally new to setting up web servers. In general, what is required is to develop an API based on this bundle, so something on this topic is also desirable. I searched on the Internet, but there are many things that it is not clear whether this is correct or not.
Answer the question
In order to leave comments, you need to log in
On the example of Ubuntu 14.04 LTS, Python 3.4.0, Django 1.7.1 for the development machine.
Install Apache 2
Install mod_wsgi for Python 3 (Apache 2 - Python 3 bundle)
Install PIP for Python 3 (package manager)
Install Django
Create a Django project
Создаем проект
$ mkdir -p /home/user/site.ru/
$ mkdir -p /home/user/site.ru/static/
$ mkdir -p /home/user/site.ru/media/
$ mkdir -p /home/user/site.ru/logs/
$ cd /home/user/site.ru/
$ django-admin.py startproject project
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName site.ru
ServerAlias www.site.ru
ErrorLog /home/user/site.ru/logs/error.log
CustomLog /home/user/site.ru/logs/access.log combined
Alias /robots.txt /home/user/site.ru/static/robots.txt
Alias /favicon.ico /home/user/user.ru/static/favicon.ico
AliasMatch ^/([^/]*\.css) /home/user/site.ru/static/styles/$1
Alias /media/ /home/user/site.ru/media/
Alias /static/ /home/user/site.ru/static/
<Directory /home/user/site.ru/static>
Require all granted
</Directory>
<Directory /home/user/site.ru/media>
Require all granted
</Directory>
WSGIScriptAlias / /home/user/site.ru/project/project/wsgi.py
<Directory /home/user/site.ru/project/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
import os
import sys
sys.path.append('/home/user/site.ru/project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
$ cd /home/user/site.ru/project
$ python3 manage.py createsuperuser
$ python3 manage.py migrate
It's better to focus on Nginx + gunicorn/uwsgi/etc. This is a more modern and flexible solution.
Hello, I can’t figure out for the second day what is the reason I do everything according to the instructions and several times, but I constantly get this message
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at site.ru Port 80
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question