#1  
Old 11th June 2008, 19:49
dayjahone dayjahone is offline
Senior Member
 
Join Date: Jan 2007
Posts: 431
Thanks: 31
Thanked 0 Times in 0 Posts
Default django

Does anyone have experience running Django on a server set up with ISPConfig?

Here are the install instructions: http://www.djangoproject.com/documentation/install/

Would this affect my ISPConfig install at all?
Reply With Quote
Sponsored Links
  #2  
Old 26th September 2009, 17:33
charles charles is offline
Banned
 
Join Date: Jun 2007
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default

C'mon, give us some answers! And instructions...
Reply With Quote
  #3  
Old 8th March 2010, 23:39
yonkman yonkman is offline
Junior Member
 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
 
Default Django and mod_wsgi

I have set up ispconfig3 + django + mod_wsgi and have gotten it to run in a vhost just fine for me. Of course, it very well might not work for anyone else and there are no stated or implied guarantees this will work.

Prerequisites:
I followed this tutorial http://www.howtoforge.com/perfect-se...10-ispconfig-3

Then:

1) installed django1.1 and latest mod_wsgi (latest version from source) as root in server (also, any other django projects that you want )
2)

Steps:

Log into ISPCONFIG 3 admin and perform the following:
1) create new website www.example.com and user with SSH access
2) create DB in IS

Next:
1) ssh into your space and from your root dir (not web) enter following command:

Code:
django-admin.py startproject myprojectnamehere
(replace last part with your proj name, of course)

Next:
CD into your new project : i.e.
Code:
 cd myprojectnamehere
Next:
create 3 directories (eggs,templates,.wsgi)

Next:
open and edit the settings.py file and add your DB information and other settings and save the file.

Next: (note you can use your own names here)
cd into the .wsgi directory and create a file inside that dir called django.wsgi This will be your mod_wsgi configuration file that will be referenced in your apache config. The names of both the dir and file are up to you be remember to change them in the following options and wsgi files.


Open and edit your .wsgi and add the following (making sure to change the paths to your server specs)


Code:
import os
import sys 
os.environ['PYTHON_EGG_CACHE'] = '/var/www/clients/client1/web1/myprojectnamehere/eggs'

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
sys.path.append('/var/www/clients/client1/web1/myprojectnamehere')
sys.stdout = sys.stderr


Next:
Save the file and go back to the ISCONFIG3 ADMIN section

Next:
go into your website section and click on the "Options" tab at the top of the section. In the Apache Directives section, enter the following making name changes where necessary.
Code:
Alias /site-media/ "/var/www/clients/client1/web1/web/site-media/"
	<Directory "/var/www/clients/client1/web1/web/site-media">
		Order allow,deny
		Options Indexes
		Allow from all
		IndexOptions FancyIndexing
	</Directory>

	Alias /admin-media/ "/usr/local/lib/python2.6/dist-packages/Django-1.1.1-py2.6.egg/django/contrib/admin/media/"
	<Directory "/usr/local/lib/python2.6/dist-packages/Django-1.1.1-py2.6.egg/django/contrib/admin/media">
		Order allow,deny
		Options Indexes
		Allow from all
		IndexOptions FancyIndexing
	</Directory>

	<Directory "/var/www/clients/client1/web1/myprojectnamehere">
		Options +ExecCGI
		Allow from all
	</Directory>
	
WSGIScriptAlias / /var/www/clients/client1/web1/myprojectnamehere/.wsgi/django.wsgi


It is very important that the WSGIScriptAlias directive come after your Apache Alias directives so that WSGI doesn't try to process /site-media/, /admin-media/ etc......

Please note I use site-media and admin-media which have to be set in the settings.py file.





That is pretty much it. Restart/Reload apache and it should work. I hope this saves someone else the time it took me to figure it all out.


Some final Notes:

I use setuptools to install django, and django projects that are available at pil. This creates the python egg issue addressed by the python egg cache config in the .wsgi file.

I had to restart apache a couple of times during my trials, but I think it might work if you can get it right the first time.



This is your basic project site for your django project. Please read all you can at djangoproject.org about building your site and troubleshooting.
Reply With Quote
The Following User Says Thank You to yonkman For This Useful Post:
falko (9th March 2010)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:31.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.