Welcome Guest | Login

Django setup?

Has anyone managed to get Django setup on HostingRails?  Is this something HostingRails supports?  

Help!
Marcus

2008-05-15 10:56 PM

These are the steps to setup django on our shared servers.


=====================================================
mkdir django_projects
---------------
$ svn co http://code.djangoproject.com/svn/django/trunk/ django_src
---------------

Edit .bash_profile to add Django to your path and python path:
---------------
export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
---------------

   *  Reload .bash_profile

---------------
$ source .bash_profile
---------------

Link admin_media to your media domain from the Django source code
---------------
$ ln -s $HOME/django_src/django/contrib/admin/media
$HOME/public_html/admin_media
---------------

Start a new project in django_projects
---------------
$ cd django_projects
$ django-admin.py startproject myproject
$ chmod 600 myproject/settings.py
---------------

Edit ~/django_projects/myproject/settings.py.
---------------
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'user_django'            
DATABASE_USER = 'user_django'            
DATABASE_PASSWORD= '******'
TIME_ZONE = 'US/Pacific'
MEDIA_ROOT = '/home/myuser/public_html/'
MEDIA_URL = http://media.mydomain.com/'
ADMIN_MEDIA_PREFIX = http://media.mydomain.com/admin_media/'
Add django.contrib.admin to INSTALLED_APPS
---------------

Change to webroot directory for mydomain.com and download fcgi.py
---------------
$ cd ~/public_html
$ wget http://svn.saddi.com/py-lib/trunk/fcgi.py
---------------

Edit ~/public_html/dispatch.fcgi

---------------
#!/usr/bin/python
import sys
sys.path += ['/home/myuser/django_src']
sys.path += ['/home/myuser/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()
---------------


Make ~/public_html/dispatch.fcgi and ~/public_html/fcgi.py executable
---------------
$ chmod +x ~/public_html/dispatch.fcgi ~/public_html/fcgi.py
---------------

Edit ~/public_html/.htaccess
---------------
RewriteEngine On
RewriteBase /
RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
---------------

   *  Initialize the DB for your project and create an admin user
---------------
$ ~/django_projects/myproject/manage.py syncdb
---------------

   *  Load http://www.mydomain.com/ in a browser and you should see the "It
worked!" page.
   * Edit ~/django_projects/myproject/urls.py and uncomment the admin line.
   * Kill the dispatch.fcgi to reload the code
---------------
$ pkill -9 dispatch.fcgi
---------------

http://www.mydomain.com/admin/ in a browser and you should see the admin login
page.

2008-05-15 11:09 PM

Regards,
Rahul
Rahul,

I ran the manage.py syncdb, and setup the database.  Now I am getting this error.  Any thoughts?


"The requested URL /dispatch.fcgi/ was not found on this server."


Thanks,
Marcus

2008-05-16 09:52 PM

Hi - I didn't see any such errors while running this command. Could you please let us know where exactly you are getting these errors and it would be better if you can post a ticket to the support team with the details of your domain and the django project. So that we can troubleshoot this issue in a better way. Thank you

2008-05-16 10:33 PM

HostingRails Support
Sorry, I was not clear.  I get that error when I attempt to go to the page in a browser.  The command completed successfully.

Should I still open a ticket?

2008-05-17 11:46 AM

I would recommend you re-installing Django. You can follow the steps given above.

Please contact support if you still need help with it.

2008-05-17 06:35 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!