I was able to run my django project:
create
/home/simbairk/.python_egg_cache (chmod 775)
/home/simbairk/public_html/.htaccess (chmod 644)
AddHandler wsgi-script .wsgi
RewriteEngine On
RewriteBase /
RewriteRule ^(dispatch\.wsgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.wsgi/$1 [QSA,PT,L]
I'm using django 1.1 and uploaded it to the public_html
/home/simbairk/public_html/dispatch.wsgi (chmod 755)
import os, sys
sys.path.append("/home/simbairk/public_html/")
sys.path.append("/home/simbairk/public_html/django")
os.environ['DJANGO_SETTINGS_MODULE'] = 'phonebook.settings' #my project name phonebook
os.environ['PYTHON_EGG_CACHE'] = '/home/simbairk/.python_egg_cache' #right 775
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
to create a database and user, I used the following script
/home/simbairk/public_html/phonebook/scripts.py
#-*-coding:utf-8-*-
from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.core.management import call_command
import os
def init_db(request):
call_command('syncdb', interactive=False)
t = get_template('index.html')
html = t.render(Context({'content':u'База инициализирована'}))
return HttpResponse(html)
def create_su(request):
call_command("createsuperuser", interactive=False, username="simba", email="haha@bugoga.yes")
u = User.objects.get(username__exact='simba')
u.set_password('simba')
u.save()
t = get_template('index.html')
html = t.render(Context({'content':u'su создан'}))
return HttpResponse(html)
do not forget to add in url.py anchor
in plane:
make /adminmake /admin/syncdbblock up the access /initdb /create_su