Danke für die Antworten!
ich habe jetzt mein Projekt auf einen FreeBSD Server gepackt. Aber ich habe den Eindruck das ich mir die Funktionalität mehr als zusammengewurschtelt habe.
Auszüge aus meiner "httpd.conf"
...
LoadModule wsgi_module libexec/apache22/mod_wsgi.so
...
mod_wsgi wird geladen...
dann
<VirtualHost xxx.xxx.xxx.xxx:80>
Alias /media /usr/home/devel/WebPortalApp/WebPortal/media
WSGIScriptAlias / /usr/home/devel/WebPortalApp/WebPortal/wsgi/django.wsgi
DirectoryIndex index.html
DocumentRoot /usr/home/devel/WebPortalApp/WebPortal/templates/
LogLevel warn
# WSGIDaemonProcess myHost processes=1 maximun-requests=1000 threads=1
# WSGIProcessGroup myHost
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /usr/home/devel/WebPortalApp/WebPortal/ >
Options Indexes FollowSymLinks MultiViews +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
vor Loadmodule Bereich habe ich dann unter anderem noch ServerName mit xxx.xxx.xxx.xxx und ServerRoot mit "/usr/local".
Python wird auf dem Server gefunden. Datenbank ist angelegt.
django.wsgi Datei:
import os
import sys
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
sys.stdout = sys.stderr
app_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),".."))
appname=app_dir.split(os.path.sep)[-1:][0]
main_dir=os.path.realpath(os.path.join(app_dir,".."))
if main_dir not in sys.path:
sys.path.append(main_dir)
if app_dir not in sys.path:
sys.path.append(app_dir)
os.environ['DJANGO_SETTINGS_MODULE'] = appname + '.settings'
import django.core.handlers.wsgi
application=django.core.handlers.wsgi.WSGIHandler()
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
ist drin, weil ich einen Fehler bekam "[erno 13]...." Egg konte nicht geschrieben werden.
Sieht das aus wie eine sinnvolle Servererinrichtung oder habe ich was vergessen?
Was mich wundert ist, obwohl ich "WSGIDaemonProcess" und "WSGIProcessGroup" auskommentiert habe, wird
das Django Framework ausgeführt.
mit:
views.py
from django.shortcuts import render_to_response
from django.http import HttpResponse
def WebPortalStartApp(request):
return HttpResponse("Hi Welt")
urls.py
from django.conf.urls.defaults import *
from WebPortal import settings
from WebPortal import views
#from django.contrib import admin
#admin.autodiscover()
urlpatterns = patterns('',
(r'^$', views.WebPortalStartApp),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
#(r'^admin/', include(admin.site.urls)),
)
und die settings.py Einträge
....
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
...
ROOT_URLCONF = 'WebPortal.urls'
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
...
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'WebPortal',
# Uncomment the next line to enable the admin:
...
LOGIN_REDIRECT_URL = '/'
Gruß
Franky