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 <[email protected]> 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 [email protected]. > To post to this group, send email to [email protected]. > 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**** [email protected] www.geraldklein.com <http://geraldklein.com/>**** geraldklein.wordpress.com [email protected]**** 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

