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..
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
xyz.com and my second app connect with its subdomain
project_folder | |->app1 | |->urls.py | |->template_folder | |->static_folder |->app2 | |->urls.py | |->template_folder | |->static_folder |->project_name |->urls.py |->wsgi.py project_name/urls.py urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^app1/', include('app1.urls')), url(r'^app2/', include('app2.urls')), ] app1/urls.py urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^example1/', views.example1), url(r'^example2/', views.example2), ) app2/urls.py 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
xyz.com and my
app2 runs on
abc.xyz.com (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
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> <Directory /home/user_name/project_folder/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> 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