Deploy django app with domain and subdomains using mod_wsgi

I am new to django and this is my first project in django. So far, I have developed a django app. It is working fluently in my local machine but I’m unable to deploy it online.

I have seen many tutorials on internet for deploying the app on server. But none of them seems to be working to me. May be I’m doing something wrong over here.

I followed these tutorials and tried to deploy the app on the server but I always gets 403 forbidden error. I tried to remove this error and referred other stackoverflow answer as well but no success..

403 Forbidden error with Django and mod_wsgi

Apache mod_wsgi error: Forbidden You don’t have permission to access / on this server

Django on apache wtih mod_wsgi (Linux) – 403 Forbidden

Installing Django with mod_wsgi

Here is the structure that i created for my django project. I have two apps in my django project and I’m connecting my one app connect with DNS and my second app connect with its subdomain


|      |->
|      |->template_folder
|      |->static_folder
|     |->
|     |->template_folder
|     |->static_folder

urlpatterns = [
    url(r'^admin/', include(,
    url(r'^app1/', include('app1.urls')),
    url(r'^app2/', include('app2.urls')),

urlpatterns = patterns('',
    url(r'^$', views.index, name='index'),
    url(r'^example1/', views.example1),
    url(r'^example2/', views.example2),

urlpatterns = patterns('',
    url(r'^example3/', views.example3),
    url(r'^example4/', views.example4),

Basically what I’m trying to do is that my app1 runs on and my app2 runs on (sub domain). So that all app in the project having same user login. If a user login from one app it will be logged in the second app also.

On my local machine the app runs as






Here is my apache2 conf file that i create on my server

ServerAdmin webmaster@localhost

DocumentRoot /home/user_name/project_folder/

<Directory />
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    AddHandler mod_python .py
    PythonHandler mod_python.publisher | .py
    PythonDebug On

<Directory /home/user_name/project_folder/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all

ErrorLog /home/user_name/project_folder/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /home/user_name/project_folder/access.log combined

Source: apache

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.