How to start project on Django?

By default, the hosting accounts created on the server with support for PHP, Django needs to configure your account transferred to another server. This action is carried out by our specialists on request ticket. After the transfer of the hosting package on the Django server, you can start setting up the project.

Do you have a project on Django? For start, you must perform

  1. Createm folder domains/DOMAIN/django/VNAME
  2. Create file domains/DOMAIN/django/VNAME.wsgi, with content (replace variables DOMAIN, USERNAME and VNAME correct values):
import os,sys

apache_configuration = os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)

os.environ['DJANGO_SETTINGS_MODULE'] = 'VNAME.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

For Django >= 1.7 you must replace this lines:

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

for this lines

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
  1. Download project to folder domains/DOMAIN/django/VNAME
  2. Write ticket to support with request to activate Django, at ticket add your Python and Django versions and VNAME, DOMAIN, USERNAME.

    If you need additional modules Python/Django - create file /home/USERNAME/domains/django/VNAME.requirements.txt at format PIP:


If not specified version of the module or version of Django, will be the installed latest version available at the time of installation. As default will be installed vesrion 2.7 Python.

If you need to create new (blank) project - you need Follow step 4


After start Django project set at file domains/DOMAIN/django/VNAME/ next parameters:

MEDIA_ROOT = '/home/USERNAME/domains/DOMAIN/public_html/media/'
STATIC_ROOT = '/home/USERNAME/domains/DOMAIN/public_html/static/'
MEDIA_URL = '/media/'
STATIC_URL = '/static/'

Description of variables:

VNAME=The project name. Must be unique.
DOMAIN=Your domain that connects to Django
USERNAME=User login. Used to access the control panel DirectAdmin

Reload project

For reload django-project you need add to file domains/DOMAIN/django/VNAME.wsgi strings:

# version 0.0.1
import rxmonitor

rxmonitor.track(os.path.join(os.path.dirname(__file__), 'VNAME.wsgi'))

After changins content in file domains/DOMAIN/django/VNAME.wsgi (as example string version 0.0.1 changed to version 0.0.2) and reloading page, Django project will be reloaded.

> Dont forget set correct values DOMAIN and VNAME