Hello,
I need help with lighttpd+fast-cgi setup, please help.
I build my project under development server (manage.py runserver).
Everything works fine. Now I setup lighttpd and django-fcgi.py according
to
https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgiLighttpd
and I get into troubles.
When I access page "/ulice/" (where I import module "utils" from the
same directory) I get error below. I think, that there is some problems
with PATHs.
On my homepage ("/"), where I have just static texts with links, there
is no problem (so I think, that lighttpd + django-fcgi setup is OK)
Here is the error:
-----------------------------------------------------
ViewDoesNotExist at /ulice/
Could not import val_mez_info.company.views. Error was: No module named
utils
Request Method: GET
Request URL: http://127.0.0.1:81/ulice/
Exception Type: ViewDoesNotExist
Exception Value: Could not import val_mez_info.company.views. Error
was: No module named utils
Exception Location:
/usr/local/lib/python2.4/site-packages/django/core/urlresolvers.py in
get_callback, line 120
Traceback (most recent call last):
File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py" in
get_response
65. callback, callback_args, callback_kwargs = resolver.resolve(path)
File
"/usr/local/lib/python2.4/site-packages/django/core/urlresolvers.py" in
resolve
147. sub_match = pattern.resolve(new_path)
File
"/usr/local/lib/python2.4/site-packages/django/core/urlresolvers.py" in
resolve
112. self.func = self.get_callback()
File
"/usr/local/lib/python2.4/site-packages/django/core/urlresolvers.py" in
get_callback
120. raise ViewDoesNotExist, "Could not import %s. Error was: %s" %
(mod_name, str(e))
ViewDoesNotExist at /ulice/
Could not import val_mez_info.company.views. Error was: No module
named utils
Here is code snippet from val_mez_info/company/views.py:
-----------------------------------------------------
from django.shortcuts import render_to_response
from datetime import datetime, timedelta
from django import forms
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from val_mez_info.company.models import Street, Company, Category,
get_company_list, get_company, get_company_category_list
from val_mez_info.company.company_add_manipulator import
CompanyAddManipulator
from val_mez_info.company.utils import get_slug_existing_company,
slugify_name, prepare_category, prepare_phone, prepare_open_times,
prepare_data_to_list_view, translate_letter
...
def street_list(request, letter=None):
letter = translate_letter(letter)
streetList = Street.objects.all()
out = prepare_data_to_list_view(streetList, 'name', letter)
return render_to_response('street_list.html', {'data': out[0],
'letter': letter, 'list': out[1], 'url': '/ulice/', 'url_postfix':'/'})
Here is my directory structure:
-----------------------------------------------------
/home/michal/www/django-server/val_mez_info
+-----company
| +-----company_add_manipulator.py
| +-----models.py
| +-----utils.py
| +-----views.py
| +-----__init__.py
+-----cust_template_tags
| +-----models.py
| +-----templatetags
| | +-----cust_template_tags.py
| | +-----__init__.py
| +-----views.py
| +-----__init__.py
+-----manage.py
+-----openweek
| +-----models.py
| +-----views.py
| +-----__init__.py
+-----README
+-----settings.py
+-----templates
| +-----base.html
| +-----category_detail.html
| +-----category_list.html
| +-----company_add.html
| +-----company_add_done.html
| +-----company_detail.html
| +-----company_list.html
| +-----help.html
| +-----home.html
| +-----letter_row.html
| +-----nonactive_list.html
| +-----street_detail.html
| +-----street_list.html
| +-----time_foot.html
| +-----user_add.html
| +-----user_login.html
+-----TODO
+-----urls.py
+-----utils.py
+-----__init__.py
Here is lighttpd.conf:
-----------------------------------------------------
server.modules = ("mod_rewrite", "mod_fastcgi")
server.document-root = "/home/michal/www/lighttp"
server.errorlog = "/var/log/lighttpd/lighttpd.error.log"
server.indexfiles = ( "index.html", "index.htm" )
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "audio/x-wav",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar"
)
server.port = 81
server.bind = "127.0.0.1"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www"
server.groupname = "www"
fastcgi.server = (
"/main.fcgi" => (
"main" => (
"socket" => "/usr/home/michal/www/django-server/sockets/main.socket",
"check-local" => "disable"
)
)
)
url.rewrite = ( "^(/.*)$" => "/main.fcgi$1", )
How I run django-fcgi.py script (script is located in /home/michal/bin
directory):
-----------------------------------------------------
django-fcgi.py --projects=/usr/home/michal/www/django-server
--settings=val_mez_info.settings
--socket=/usr/home/michal/www/django-server/sockets/main.socket
--minspare=1 --maxspare=1 --maxchildren=1 --daemon
I am using Django from trunk, revision 3201, under FreeBSD 5.4 system.
Thank you for any help.
Regards
Michal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---