cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
I think it relies upon mod_python, which you would need to install manually. Once that is done, setup is rather easy using the Python setup tools. Performance issues will like be the same as any other dynamic language (PHP, Perl, etc). If you don't have any experience with Python specific services, you might want to do some research on Python-specific sites.
 

phred_02

Member
Jan 25, 2004
5
0
151
I have also been looking into running Django with Cpanel. If you choose to go the mod_python route you will need to be running apache 2.

From what I have been reading, it is also possible to run Django with FastCGI, but I am still unclear if this also requires apache 2.
 

phred_02

Member
Jan 25, 2004
5
0
151
I managed to get django running on Apache 1.3 using mod_wsgi. Mod_wsgi will also work with apache 2. I would be happy to help if necessary.
 

darren.nolan

Well-Known Member
Oct 4, 2007
257
0
66
Howdy everyone. Yay for my first post.

I've been trolling on these forums for a little while now, everyone seems really switched on - a nice change from the rest of the internet and forums out there.

I updated Apache from 1.3 to 2.2 in preparation to install Django (not interested in using FastCGI) - everything went pretty smoothly when switched over to EDGE.

I have Python 2.4.4 and mod_python installed, now it's just time for Django. I've never used Django, nor do I really want to learn what it's about. When reading the install guide, it gives several branches to setup for either MySQL, PostgreSQL, SQLite - can't I use all depending on the end user/programmer?

I'm about to have a little stab at it and will write back if I have any troubles - any heads up would be awesome.

Cheers Guys.
Dazz
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
Howdy everyone. Yay for my first post.

I've been trolling on these forums for a little while now, everyone seems really switched on - a nice change from the rest of the internet and forums out there.

I updated Apache from 1.3 to 2.2 in preparation to install Django (not interested in using FastCGI) - everything went pretty smoothly when switched over to EDGE.

I have Python 2.4.4 and mod_python installed, now it's just time for Django. I've never used Django, nor do I really want to learn what it's about. When reading the install guide, it gives several branches to setup for either MySQL, PostgreSQL, SQLite - can't I use all depending on the end user/programmer?

I'm about to have a little stab at it and will write back if I have any troubles - any heads up would be awesome.

Cheers Guys.
Dazz
As long as you have the Python interfaces for PostgreSQL, MySQL and SQLite, DJango will work with them. It then depends upon the configuration of the Django application. There may be more to it, as I've only progressed to the point of installing Django, not actually using it.
 

rsferreira

Member
May 20, 2003
9
0
151
It would be nice to be able to easily run Django applications on cPanel servers.

We'd prefer to use Django for many web applications we're developing, but we had to choose a PHP framework just because running Django on a cPanel shared hosting would be - AFAIK - a nightmare.

Regards,
Rodrigo
 

darren.nolan

Well-Known Member
Oct 4, 2007
257
0
66
It would be nice to be able to easily run Django applications on cPanel servers.

We'd prefer to use Django for many web applications we're developing, but we had to choose a PHP framework just because running Django on a cPanel shared hosting would be - AFAIK - a nightmare.

Regards,
Rodrigo
Not sure I follow this. You'd have to explain. Django works fine on a shared host for me, you can setup inside <virtualhost></virtualhost> your site's settings etc, so I'd love a clarification on this.

I'm in the same boat as cpanelkenneth mostly, I've installed everything, everything appears to work and I have two-three people using it at the moment. They just open a support ticket and ask me nicely to change the apache conf file for settings as needed.
 

hbouma

Well-Known Member
Jun 8, 2002
61
1
308
Leaning towards fcgi for django

I've had a client ask to install this on a VPS and I'm leaning towards using fcgi over mod_python for the simple reason that with mod_python they have to restart apache to see their changes. Whereas with the fastcgi method, it will load the new changes without any restarts. Which simplifies things as its a production server. Since he's also using Ruby, that will be two services using fastcgi as well.

Hal
 

shacker23

Well-Known Member
Feb 20, 2005
263
1
168
I'm getting a number of Django requests lately as well. cPanel did such a nice job with the Rails integration, sure would be nice to see parallel support for Django.
 

esolutions

Member
Aug 16, 2006
18
0
151
Any updates on this? I'm thinking of setting up Django on my WHM server but I'd rather not do it by hand. If anything could we get a How-To from either cPanel or the community?
 

shacker23

Well-Known Member
Feb 20, 2005
263
1
168
esolutions - I don't think you have a choice beyond setting up Django by hand at this point. If cPanel adopts Django it'll rock my world, but for now it's a fully manual process.

We recently did a big Django rollout on cPanel at work and one of our developers wrote a really nice step-by-step guide to the setup:

http://m.andric.us/post/43754517/django-python-with-cpanel

Comments welcome. HTH!
 

djbob2

Well-Known Member
May 14, 2005
99
0
166
Thanks a lot for the tutorial! I am actually currently working on installing Django on my cPanel box and this should help. I will get back to you on this.

Question: is there any way to enable Django without having to individually modify every virtualhost to enable Django on a per-account basis? Are WSGI directives able to execute in .htaccess files? And if not, how hard would it be to add the required directives by default on new cPanel accounts? The django.wsgi file and a folder for django apps can easily be auto-created using cPanel/WHM's Skeleton Directory feature.
 

shacker23

Well-Known Member
Feb 20, 2005
263
1
168
djbob2 - I haven't tried this, but I believe that you can modify

Code:
/var/cpanel/templates/apache2/vhost.conf
Then when you create new vhosts their configurations will be based on that. So think of it as a companion to the skeleton system. I'm not sure whether cpanel updates would overwrite your changes to that file.
 

djbob2

Well-Known Member
May 14, 2005
99
0
166
Thanks shacker! I will try this either today or tommorow and let you know how it went.
 

mandric

Registered
May 30, 2008
1
0
51
using .htaccess

Sure you can use .htaccess, that works too. But from my experiments it only works with embedded mode. So you may lose some benefits of the daemon mode. But that's a good question and if you ask the list or search around a bit you'll surely come up with something.

According to the docs WSGIScriptAlias directive only works in a vhost container or server wide (globally).
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIScriptAlias

To do mod_wsgi in embedded mode using .htaccess you can use something like this.

RewriteEngine On
RewriteBase /
# Skip the media dirs
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]

# Rewrite everything else to disptach.wsgi
RewriteRule ^(dispatch\.wsgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.wsgi/$1 [QSA,PT,L]

Of course you need to tell apache what to do with .wsgi as well by adding these globally:
LoadModule wsgi_module /usr/local/apache/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
 
Last edited: