Created
July 23, 2010 14:00
-
-
Save Ionshard/487468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## This is the file django.wsgi located at [/path/to/your/feral/home]/www/[example.com]/django.wsgi | |
| import os | |
| import sys | |
| installation = os.path.expanduser('~/private') | |
| website = os.path.expanduser('~/www/example.com') | |
| sys.path.append(installation) | |
| sys.path.append(website) | |
| os.environ['DJANGO_SETTINGS_MODULE'] = 'website.settings' | |
| import django.core.handlers.wsgi | |
| application = django.core.handlers.wsgi.WSGIHandler() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## This needs to be configured. Please replace everything within the [] brackets | |
| ## This has to go into the global configuration file, so you need an admin to do it. | |
| Alias /robots.txt [/path/to/your/feral/home]/www/[example.com]/public_html/robots.txt | |
| Alias /favicon.ico [/path/to/your/feral/home]/www/[example.com].com/public_html/favicon.ico | |
| Alias /media/ [/path/to/your/feral/home]/www/[example.com]/public_html/media/ | |
| <Directory [/path/to/your/feral/home]/www/[example.com]/public_html/> | |
| Order deny,allow | |
| Allow from all | |
| </Directory> | |
| WSGIScriptAlias / [/path/to/your/feral/home]/www/[example.com]/django.wsgi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Edit the Feral Virtual Host Requirements by replacing all square brackets with the proper information and removing the comments at the top. | |
| Submit a ticket requesting that it be added to your Virtual Host directive in Apache's httpd.conf. Also request that python-mysqldb be installed on your server if it isn't already | |
| Put the file django.wsgi where you configured the Virtual Host to look for it via WSGIScriptAlias and change the paths to their appropriate values. | |
| Download django to your ~/private directory. I like to use svn trunk so I do the following | |
| cd ~/private | |
| svn co http://code.djangoproject.com/svn/django/trunk/ | |
| ln -s trunk/django . | |
| and that will allow me to keep my svn and make Django accessible. | |
| Now to access the tool django-admin.py you either have to call it directly via ~/private/django/bin/django-admin.py or you can: | |
| mkdir ~/bin | |
| cd ~/bin | |
| ln -s ~/private/django/bin/django-admin.py . | |
| and that will put it on the path (have to love symlink hacks) | |
| Now you need to set your website up, http://docs.djangoproject.com/en/dev/intro/tutorial01/ is good for this. Where ever you make the project needs to be reflected in the two lines in django.wsgi | |
| website = os.path.expanduser('~/www/example.com') | |
| os.environ['DJANGO_SETTINGS_MODULE'] = 'website.settings' | |
| the first line must be the parent of where your django project is and the second one must be your project.settings. | |
| After that it's all following the tutorial EXCEPT getting MySQL to connect via a unix socket. To do that you have to have | |
| DATABASES = { | |
| 'default': { | |
| 'ENGINE': 'mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | |
| 'NAME': '', # Or path to database file if using sqlite3. | |
| 'USER': '', # Not used with sqlite3. | |
| 'PASSWORD': '', # Not used with sqlite3. | |
| 'HOST': '/path/to/home/private/mysql/socket', # Set to empty string for localhost. Not used with sqlite3. | |
| 'PORT': '', # Set to empty string for default. Not used with sqlite3. | |
| } | |
| } | |
| DATABASE_OPTIONS = { | |
| 'unix_socket' : '/path/to/home/private/mysql/socket' | |
| } | |
| Where HOST and 'unix_socket' is adjusted according to your own home directory. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment