2010-12-29 7 views
0

Ich bin aber sehr neu django und lighttpd und haben eine sehr grobe Vorstellung über FastCGI. Ich habe ein Django-Projekt namens 'myproject' unter meinem "server.document-root".Import in Django mit FastCGI & Lighttpd

Wenn ich versuche, die folgende URL zu durchsuchen:

http://192.168.1.198:8093/myproject.fcgi 

ich einen Importfehler zu sagen:

Request Method:  GET 

Request URL: http://192.168.1.198:8093/myproject.fcgi 

Django Version:  1.2.4 

Exception Type:  ImportError 

Exception Value:  

No module named myproject.urls 

Exception Location:  /usr/lib/python2.6/site-packages/django/utils/importlib.py in 

import_module, line 35 

Python Executable: /usr/bin/python2.6 

Python Version:  2.6.2 

Das Snippet meiner "lighttpd.conf" Datei für FastCGI Konfiguration ist:

$HTTP["host"] =~ "192\.168\.1\.198" {                  
fastcgi.server = (                      
    ".fcgi" => (                      
     "192\.168\.1\.198" => (                  
      "bin-path" => "/satellite_app/webservers/lighttpd/var/www/htdocs/myproject/myproject.fcgi", 
      "socket" => "/tmp/myproject.sock",               
      "check-local" => "disable",                 
      "min-procs" => 2,                   
      "max-procs" => 4,                   
     )                        
    ),                                            

)                          

alias.url = (                       
    "/media" => "/usr/lib/python2.6/site-packages/django/contrib/admin/media/",       
)                          

url.rewrite-once = (                     
    "^(/media.*)$" => "$1",                    
    "^/favicon\.ico$" => "/media/favicon.ico",               
    "^(/.*)$" => "/myproject$1",                  
    ## "^(/.*)$" => "/myproject.fcgi$1",                 

) 
} 

Ich bin nicht in der Lage zu identifizieren, warum ich den "ImportError" bekomme. Fehle ich irgendwo die Importanweisung? Wenn ja, sag mir bitte wo genau?

Vielen Dank im Voraus.

Antwort

0

Ok, da ich das Problem herausgefunden ich mir meine eigene Frage der Hoffnung bin zu beantworten, dass es andere Neulingen wie mir helfen würde ..

Es gab ein Problem mit dem Wert von DJANGO_MODULE_SETTINGS.

Einstellung als:

os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings" 

löste mein Import ... :-)