views:

44

answers:

1

Im trying to deploy my django and I always get one of these erros: (they alternate as I refresh the page)

  • The model Page has already been registered ( its from feincms, but i dont get this on my computer )

  • unable to open database file (the database is sqlite3 and was successfully created with syncdb on the server )

Any ideas on what might be the problem ?

+2  A: 

First one is probably because on your local computer you run Django as CGI, or some other "new request - different process" way. So if you registering Page model in every request, it's works because you have single request. But on web server your app is loaded as FCGI or some other way like this, so only first request can be served well (when second request is send, your app tries to register Page model again).

Second one is probably because you have relative path to db file. So if you type

./manage syncdb

in your project dir '/my/project/dir'. Django searches for file in '/my/projec/dir/mydb.sqlite'.

But if you run it in web server, you have different path '/some/http/server/path', so your program is confused.

Tomasz Wysocki
My path is relative, simply the name of the file, so shouldnt django just look for the file in the project's folder wherever it is ?I didnt understant what should I do to fix the first problem.
Victor
No. When path is relative any program (any language, not only Python) looks in directory what is called "current directory". When you are running program from console you can check your current directory typing "pwd" in console. If your project is running via http server (ie. Apache) your "current directory" can be set to literally anything (based on http server, configuration, way of running program (CGI, fcgi, mod_python) etc.) So the best approach is to not use relative paths in web applications.Example how to use absolute paths in settings.py:http://djangosnippets.org/snippets/445/
Tomasz Wysocki
Thanks ! Everything is working just fine now =)
Victor