Setting up Django on GoDaddy Deluxe Shared Hosting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting up Django on GoDaddy Deluxe Shared Hosting

Donald H

Has anyone had success in setting up Django on GoDaddy's Deluxe shared
hosting plan?  It supports Python CGI, but has no shell access. I read
a previous post from October 2006, where I read of another user who
did the same things I did (guided by the django documentation for
shared hosts), but now I'm stuck. I'm hoping someone has managed more
success than this since October 2006.

I created a "myaite.fcgi" script, but I was confused by some of the
items.  For example, adding the custom Python path with
"sys.path.insert(0,"/home/user/python")" - what is that?  If python is
already installed at "/usr/bin/python", what would this do?

And I don't even know if fastcgi is accessible for python.  I come
from a .Net/Java background and everything apache- and cgi-based is
quite foreign to me.

And I know I could switch to a different host, but I already have
several other domains hosted at godaddy and would prefer not to have
to change hosts to use Django.

Thanks for any direction you guys can offer (even if it's to tell me
it's not possible).

Donald H.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Tim Chase-7

> Has anyone had success in setting up Django on GoDaddy's Deluxe shared
> hosting plan?  It supports Python CGI, but has no shell access.

CGI != FastCGI != WSGI

If all they offer is CGI, the general consensus is that you ought
look elsewhere as (1) it's not supported in Django and (2) if it
was supported in Django, performance would be abysmal in an
off-the-charts sort of way.  A new python process is started for
each request, all the code is hauled into memory for one request,
and then disposed of.  Not bad for small sites with low-volume
traffic.  But it easily gets swamped.  A  better alternative is
to have the python interpreter stick around with your code in
memory once and then pass requests to the existing code.  Enter
FastCGI, WSGI and mod_python to solve this problem, each in its
own way.

Python does do CGI, FastCGI and WSGI as well as the obvious
mod_python. :)

Django/Python does FastCGI and WSGI as well as mod_python.

> And I don't even know if fastcgi is accessible for python.  I come
> from a .Net/Java background and everything apache- and cgi-based is
> quite foreign to me.

Hopefully the above description helps clarify the "fastcgi !=
cgi" confusion here.


I don't know what GoDaddy offers in the package you are using.
If it's CGI, your outta luck.  However, if they do offer FastCGI
or WSGI, you're in luck (nothing you mentioned sounded like they
offered mod_python).

-tim



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Donald H

Thanks for the quick and thorough response, Tim!

I'll find out if the FastCGI they advertise as being available for
Ruby on Rails could also be made accessible to Python by following the
Shared Hosting instructions at the bottom of http://www.djangoproject.com/documentation/fastcgi/.





On Dec 28, 4:35 pm, Tim Chase <[hidden email]> wrote:

> > Has anyone had success in setting up Django on GoDaddy's Deluxe shared
> > hosting plan?  It supports Python CGI, but has no shell access.
>
> CGI != FastCGI != WSGI
>
> If all they offer is CGI, the general consensus is that you ought
> look elsewhere as (1) it's not supported in Django and (2) if it
> was supported in Django, performance would be abysmal in an
> off-the-charts sort of way.  A new python process is started for
> each request, all the code is hauled into memory for one request,
> and then disposed of.  Not bad for small sites with low-volume
> traffic.  But it easily gets swamped.  A  better alternative is
> to have the python interpreter stick around with your code in
> memory once and then pass requests to the existing code.  Enter
> FastCGI, WSGI and mod_python to solve this problem, each in its
> own way.
>
> Python does do CGI, FastCGI and WSGI as well as the obvious
> mod_python. :)
>
> Django/Python does FastCGI and WSGI as well as mod_python.
>
> > And I don't even know if fastcgi is accessible for python.  I come
> > from a .Net/Java background and everything apache- and cgi-based is
> > quite foreign to me.
>
> Hopefully the above description helps clarify the "fastcgi !=
> cgi" confusion here.
>
> I don't know what GoDaddy offers in the package you are using.
> If it's CGI, your outta luck.  However, if they do offer FastCGI
> or WSGI, you're in luck (nothing you mentioned sounded like they
> offered mod_python).
>
> -tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Donald H

Here's what I asked GoDaddy Support:

"Is FastCGI accessible from python scripts if I add my own handler? I
ask
this in specific relation to setting up Django. Is this known not to
work?"


Here's their response:

"FastCGI is accessible from Python scripts for our Linux hosting
accounts. We do not allow, however, the addition of a custom FastCGI
handler in our shared hosting accounts."


Does this mean I am definitively out of luck?


Thanks again for your help.



On Dec 28, 6:17 pm, Donald H <[hidden email]> wrote:

> Thanks for the quick and thorough response, Tim!
>
> I'll find out if the FastCGI they advertise as being available for
> Ruby on Rails could also be made accessible to Python by following the
> Shared Hosting instructions at the bottom ofhttp://www.djangoproject.com/documentation/fastcgi/.
>
> On Dec 28, 4:35 pm, Tim Chase <[hidden email]> wrote:
>
> > > Has anyone had success in setting up Django on GoDaddy's Deluxe shared
> > > hosting plan?  It supports Python CGI, but has no shell access.
>
> > CGI != FastCGI != WSGI
>
> > If all they offer is CGI, the general consensus is that you ought
> > look elsewhere as (1) it's not supported in Django and (2) if it
> > was supported in Django, performance would be abysmal in an
> > off-the-charts sort of way.  A new python process is started for
> > each request, all the code is hauled into memory for one request,
> > and then disposed of.  Not bad for small sites with low-volume
> > traffic.  But it easily gets swamped.  A  better alternative is
> > to have the python interpreter stick around with your code in
> > memory once and then pass requests to the existing code.  Enter
> > FastCGI, WSGI and mod_python to solve this problem, each in its
> > own way.
>
> > Python does do CGI, FastCGI and WSGI as well as the obvious
> > mod_python. :)
>
> > Django/Python does FastCGI and WSGI as well as mod_python.
>
> > > And I don't even know if fastcgi is accessible for python.  I come
> > > from a .Net/Java background and everything apache- and cgi-based is
> > > quite foreign to me.
>
> > Hopefully the above description helps clarify the "fastcgi !=
> > cgi" confusion here.
>
> > I don't know what GoDaddy offers in the package you are using.
> > If it's CGI, your outta luck.  However, if they do offer FastCGI
> > or WSGI, you're in luck (nothing you mentioned sounded like they
> > offered mod_python).
>
> > -tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Radomir Wojcik
I was looking for the answer to this today and I wrote a tutorial on how to do this based on all the stuff I found on the net:

With the economy class Linux hosting its a bit tricky. For starters you don't have root access to the site packages so you cannot install for example MySQL-Python.

1. Godaddy has virtualenv installed, so first, create a virtual environment venv: (I use $HOME/lib/ for all the installed stuff below)

cd ~/
mkdir lib
cd lib
virtualenv --no-site-packages venv

The python package folder is $HOME/lib/venv/lib/python2.7/site-packages

2. Install the latest Django through pip

pip install Django

3. Create a new project

django-admin.py startproject mysite

4. Change the database configuration in mysite/setting.py file. When setting the path for the database file, please use the absolute path:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': '/var/chroot/home/content/11/10420811/lib/venv/mysite/mydatabase.db',                      
        'USER': '',
        'PASSWORD': '',
        'HOST': '',                    
        'PORT': '',                     
    }
}

While in here there are a few other things to consider changing:

  • ADMINS = can be updated with your info
  • TIME_ZONE = 'America/Toronto'
  • LANGUAGE_CODE = 'en-ca'
  • STATIC_ROOT = '/var/chroot/home/content/11/10420811/lib/venv/mysite/static/'
  • Uncommenting admin in INSTALLED_APPS : 'django.contrib.admin',

This will save you some setup later!

5. Set the Locale information in $HOME/.bash_profile file, otherwise you cannot set the superuser when you sync the database. You can edit the file with vim:

 export LANG=en_US.UTF-8
 export LC_ALL=en_US.UTF-8

6. Now run the script using the script command:

source ~/.bash_profile

7. If everything is setup properly, you should be able to sync the database:

python2.7 manage.py syncdb

You should see the admin tables get created and it will ask you to create a new user.

8. Now we setup the dispatch functionality so we can access the webpage without running server through Django using flup. So download and untar flup:

cd ~/lib/venv/lib/python2.7/site-packages
wget http://pypi.python.org/packages/source/f/flup/flup-1.0.2.tar.gz#md5=24dad7edc5ada31dddd49456ee8d5254
tar -xvzf flup-1.0.2.tar.gz
mv flup-1.0.2/flup/ .

9. In $HOME/html folder, create dispatch.py and add the following lines of code:

#!/usr/local/bin/python2.7
import sys, os
sys.path += ['/your/home/path/lib/venv/lib/python2.7/site-packages']
sys.path += ['/your/home/path/lib/mysite/']
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

Also do a chmod +x dispatch.py to make the python script executable!

10. In $HOME/html/.htaccess file, add the following codes:

AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# everything else sent to django
RewriteRule ^(dispatch\.py/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.py/$1 [L]

Another good thing to note is that you can ReWrite URLS if you have current applications isntalled, ie.e dokuwiki.

#Add this above "everything else sent to django"
#Below other folders with static content and PHP , etc..
#hosted at yourdomain/dokuwiki
RewriteRule ^(dokuwiki/.*)$ - [L]

#You can also create your "django" project at a different location rather than your domain root by changing the 2nd RewriteRule , i.e.:

# everything else sent to django
RewriteRule ^(dispatch\.py/.*)$ - [L]
RewriteRule ^(djangoproj/.*)$ dispatch.py/$1 [L]
#Make sure to create the djangoproj folder inside your html dir, cd html; mkdir djangproj
#This becomes a bit annoying because your urlpatterns in url.py will now always have to include 'djangoproj' at the beginning.

11. Update your urls.py file to look like so:

from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^static/(.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
    url(r'^admin/', include(admin.site.urls)),
)

This will ensure you can access the admin application, as well as the static root where all your img js and css are. Also note to copy the admin img/js/css from /django/contrib/admin/static. Mine was in

~/lib/venv/lib/python2.7/site-packages/django/contrib/admin/

I used cp -r to copy it over to my application static dir/var/chroot/home/content/11/10420811/lib/venv/mysite/static/

cp -r ~/lib/venv/lib/python2.7/site-packages/django/contrib/admin/ ~/lib/venv/mysite/static/

12. That is it, you should have access to your site now! Access to http://your.website.com/adminshould work!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Gerald Klein
Wow thanks amazing work, I wondered if someone had figured out a way to do it. 

thanks 

--jerry


On Fri, May 10, 2013 at 1:04 PM, Radomir Wojcik <[hidden email]> wrote:
I was looking for the answer to this today and I wrote a tutorial on how to do this based on all the stuff I found on the net:

With the economy class Linux hosting its a bit tricky. For starters you don't have root access to the site packages so you cannot install for example MySQL-Python.

1. Godaddy has virtualenv installed, so first, create a virtual environment venv: (I use $HOME/lib/ for all the installed stuff below)

cd ~/
mkdir lib
cd lib
virtualenv --no-site-packages venv

The python package folder is $HOME/lib/venv/lib/python2.7/site-packages

2. Install the latest Django through pip

pip install Django

3. Create a new project

django-admin.py startproject mysite

4. Change the database configuration in mysite/setting.py file. When setting the path for the database file, please use the absolute path:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': '/var/chroot/home/content/11/10420811/lib/venv/mysite/mydatabase.db',                      
        'USER': '',
        'PASSWORD': '',
        'HOST': '',                    
        'PORT': '',                     
    }
}

While in here there are a few other things to consider changing:

  • ADMINS = can be updated with your info
  • TIME_ZONE = 'America/Toronto'
  • LANGUAGE_CODE = 'en-ca'
  • STATIC_ROOT = '/var/chroot/home/content/11/10420811/lib/venv/mysite/static/'
  • Uncommenting admin in INSTALLED_APPS : 'django.contrib.admin',

This will save you some setup later!

5. Set the Locale information in $HOME/.bash_profile file, otherwise you cannot set the superuser when you sync the database. You can edit the file with vim:

 export LANG=en_US.UTF-8
 export LC_ALL=en_US.UTF-8

6. Now run the script using the script command:

source ~/.bash_profile

7. If everything is setup properly, you should be able to sync the database:

python2.7 manage.py syncdb

You should see the admin tables get created and it will ask you to create a new user.

8. Now we setup the dispatch functionality so we can access the webpage without running server through Django using flup. So download and untar flup:

cd ~/lib/venv/lib/python2.7/site-packages
wget http://pypi.python.org/packages/source/f/flup/flup-1.0.2.tar.gz#md5=24dad7edc5ada31dddd49456ee8d5254
tar -xvzf flup-1.0.2.tar.gz
mv flup-1.0.2/flup/ .

9. In $HOME/html folder, create dispatch.py and add the following lines of code:

#!/usr/local/bin/python2.7
import sys, os
sys.path += ['/your/home/path/lib/venv/lib/python2.7/site-packages']
sys.path += ['/your/home/path/lib/mysite/']
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

Also do a chmod +x dispatch.py to make the python script executable!

10. In $HOME/html/.htaccess file, add the following codes:

AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# everything else sent to django
RewriteRule ^(dispatch\.py/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.py/$1 [L]

Another good thing to note is that you can ReWrite URLS if you have current applications isntalled, ie.e dokuwiki.

#Add this above "everything else sent to django"
#Below other folders with static content and PHP , etc..
#hosted at yourdomain/dokuwiki
RewriteRule ^(dokuwiki/.*)$ - [L]

#You can also create your "django" project at a different location rather than your domain root by changing the 2nd RewriteRule , i.e.:

# everything else sent to django
RewriteRule ^(dispatch\.py/.*)$ - [L]
RewriteRule ^(djangoproj/.*)$ dispatch.py/$1 [L]
#Make sure to create the djangoproj folder inside your html dir, cd html; mkdir djangproj
#This becomes a bit annoying because your urlpatterns in url.py will now always have to include 'djangoproj' at the beginning.

11. Update your urls.py file to look like so:

from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^static/(.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
    url(r'^admin/', include(admin.site.urls)),
)

This will ensure you can access the admin application, as well as the static root where all your img js and css are. Also note to copy the admin img/js/css from /django/contrib/admin/static. Mine was in

~/lib/venv/lib/python2.7/site-packages/django/contrib/admin/

I used cp -r to copy it over to my application static dir/var/chroot/home/content/11/10420811/lib/venv/mysite/static/

cp -r ~/lib/venv/lib/python2.7/site-packages/django/contrib/admin/ ~/lib/venv/mysite/static/

12. That is it, you should have access to your site now! Access to http://your.website.com/adminshould work!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Gerald Klein DBA

[hidden email]

www.geraldklein.com

geraldklein.wordpress.com

[hidden email]

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Tom Evans-3
In reply to this post by Radomir Wojcik
On Fri, May 10, 2013 at 7:04 PM, Radomir Wojcik <[hidden email]> wrote:

> I was looking for the answer to this today and I wrote a tutorial on how to
> do this based on all the stuff I found on the net:
>
> With the economy class Linux hosting its a bit tricky. For starters you
> don't have root access to the site packages so you cannot install for
> example MySQL-Python.
>
> 1. Godaddy has virtualenv installed, so first, create a virtual environment
> venv: (I use $HOME/lib/ for all the installed stuff below)
>
> cd ~/
> mkdir lib
> cd lib
> virtualenv --no-site-packages venv
>
> The python package folder is $HOME/lib/venv/lib/python2.7/site-packages
>
> 2. Install the latest Django through pip
>
> pip install Django
>

Are you not missing a step between 1) and 2), you need to activate the
virtualenv, so that django (and all other libraries) are installed in
the right place.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

Kapil Chandra
In reply to this post by Radomir Wojcik
Just wanted to say that this seemed to work for getting Flask running on godaddy too (skipping the django specific steps of course) with two differences. In dispatch.py instead of:

from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()
use:

from yourapp import app
WSGIServer(app).run()
And in .htaccess I had to add:

AddHandler fcgid-script .py

All the other steps were the same - thanks so much for posting this. 



On Friday, May 10, 2013 2:04:16 PM UTC-4, Radomir Wojcik wrote:
I was looking for the answer to this today and I wrote a tutorial on how to do this based on all the stuff I found on the net:

With the economy class Linux hosting its a bit tricky. For starters you don't have root access to the site packages so you cannot install for example MySQL-Python.

1. Godaddy has virtualenv installed, so first, create a virtual environment venv: (I use $HOME/lib/ for all the installed stuff below)

cd ~/
mkdir lib
cd lib
virtualenv --no-site-packages venv

The python package folder is $HOME/lib/venv/lib/python2.7/site-packages

2. Install the latest Django through pip

pip install Django

3. Create a new project

django-admin.py startproject mysite

4. Change the database configuration in mysite/setting.py file. When setting the path for the database file, please use the absolute path:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': '/var/chroot/home/content/11/10420811/lib/venv/mysite/mydatabase.db',                      
        'USER': '',
        'PASSWORD': '',
        'HOST': '',                    
        'PORT': '',                     
    }
}

While in here there are a few other things to consider changing:

  • ADMINS = can be updated with your info
  • TIME_ZONE = 'America/Toronto'
  • LANGUAGE_CODE = 'en-ca'
  • STATIC_ROOT = '/var/chroot/home/content/11/10420811/lib/venv/mysite/static/'
  • Uncommenting admin in INSTALLED_APPS : 'django.contrib.admin',

This will save you some setup later!

5. Set the Locale information in $HOME/.bash_profile file, otherwise you cannot set the superuser when you sync the database. You can edit the file with vim:

 export LANG=en_US.UTF-8
 export LC_ALL=en_US.UTF-8

6. Now run the script using the script command:

source ~/.bash_profile

7. If everything is setup properly, you should be able to sync the database:

python2.7 manage.py syncdb

You should see the admin tables get created and it will ask you to create a new user.

8. Now we setup the dispatch functionality so we can access the webpage without running server through Django using flup. So download and untar flup:

cd ~/lib/venv/lib/python2.7/site-packages
wget <a href="http://pypi.python.org/packages/source/f/flup/flup-1.0.2.tar.gz#md5=24dad7edc5ada31dddd49456ee8d5254" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Ff%2Fflup%2Fflup-1.0.2.tar.gz%23md5%3D24dad7edc5ada31dddd49456ee8d5254\46sa\75D\46sntz\0751\46usg\75AFQjCNFiY0Kn9YQHM7SFkWtMl1tafrMnBQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Ff%2Fflup%2Fflup-1.0.2.tar.gz%23md5%3D24dad7edc5ada31dddd49456ee8d5254\46sa\75D\46sntz\0751\46usg\75AFQjCNFiY0Kn9YQHM7SFkWtMl1tafrMnBQ';return true;">http://pypi.python.org/packages/source/f/flup/flup-1.0.2.tar.gz#md5=24dad7edc5ada31dddd49456ee8d5254
tar -xvzf flup-1.0.2.tar.gz
mv flup-1.0.2/flup/ .

9. In $HOME/html folder, create dispatch.py and add the following lines of code:

#!/usr/local/bin/python2.7
import sys, os
sys.path += ['/your/home/path/lib/venv/lib/python2.7/site-packages']
sys.path += ['/your/home/path/lib/mysite/']
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

Also do a chmod +x dispatch.py to make the python script executable!

10. In $HOME/html/.htaccess file, add the following codes:

AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# everything else sent to django
RewriteRule ^(dispatch\.py/.*)$ - [L]
RewriteRule ^(.*)$ <a href="http://dispatch.py/$1" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdispatch.py%2F%241\46sa\75D\46sntz\0751\46usg\75AFQjCNEarYFlxnWBT3QyHwBxopzGFfLeDA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdispatch.py%2F%241\46sa\75D\46sntz\0751\46usg\75AFQjCNEarYFlxnWBT3QyHwBxopzGFfLeDA';return true;">dispatch.py/$1 [L]

Another good thing to note is that you can ReWrite URLS if you have current applications isntalled, ie.e dokuwiki.

#Add this above "everything else sent to django"
#Below other folders with static content and PHP , etc..
#hosted at yourdomain/dokuwiki
RewriteRule ^(dokuwiki/.*)$ - [L]

#You can also create your "django" project at a different location rather than your domain root by changing the 2nd RewriteRule , i.e.:

# everything else sent to django
RewriteRule ^(dispatch\.py/.*)$ - [L]
RewriteRule ^(djangoproj/.*)$ <a href="http://dispatch.py/$1" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdispatch.py%2F%241\46sa\75D\46sntz\0751\46usg\75AFQjCNEarYFlxnWBT3QyHwBxopzGFfLeDA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdispatch.py%2F%241\46sa\75D\46sntz\0751\46usg\75AFQjCNEarYFlxnWBT3QyHwBxopzGFfLeDA';return true;">dispatch.py/$1 [L]
#Make sure to create the djangoproj folder inside your html dir, cd html; mkdir djangproj
#This becomes a bit annoying because your urlpatterns in url.py will now always have to include 'djangoproj' at the beginning.

11. Update your urls.py file to look like so:

from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^static/(.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
    url(r'^admin/', include(admin.site.urls)),
)

This will ensure you can access the admin application, as well as the static root where all your img js and css are. Also note to copy the admin img/js/css from /django/contrib/admin/static. Mine was in

~/lib/venv/lib/python2.7/site-packages/django/contrib/admin/

I used cp -r to copy it over to my application static dir/var/chroot/home/content/11/10420811/lib/venv/mysite/static/

cp -r ~/lib/venv/lib/python2.7/site-packages/django/contrib/admin/ ~/lib/venv/mysite/static/

12. That is it, you should have access to your site now! Access to <a href="http://your.website.com/admin" title="http://your.website.com/admin" rel="nofollow" style="outline:none;text-decoration:none;color:rgb(43,115,183);padding:0px 0px 0px 18px;background-image:url(http://dokuwiki.cldssinc.com/lib/images/external-link.png);background-repeat:no-repeat no-repeat" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fyour.website.com%2Fadmin\46sa\75D\46sntz\0751\46usg\75AFQjCNG_EKORtfdxhivE0Qy607_f-BV3Hw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fyour.website.com%2Fadmin\46sa\75D\46sntz\0751\46usg\75AFQjCNG_EKORtfdxhivE0Qy607_f-BV3Hw';return true;">http://your.website.com/adminshould work!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0af288e0-60f5-45e4-9d0b-7a223d3ca784%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Setting up Django on GoDaddy Deluxe Shared Hosting

saurabhmishra4894
In reply to this post by Donald H
someone help me i am getting thi 500 internal error i dont understand whats wrong 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b993571b-1f0d-4d3c-bb1c-8efbfe5bbe91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.