I've been very happily developing my Django site with the development
server, and decided it was time to start it under Apache.  I ran into
several problems that really slowed my development down.  I'm posting here 
because:

  a. I'd love some help with these if anyone can offer it; many of my
     "solutions" don't seem too clean.

  b. In the documentation, some note about how to get over the humps
     would be very useful

The first problem was that my App seems to make a number of
assumptions based on the current directory where the development
server is run.  Although my project is a Python package (it has an
__init__.py) and I make an effort to qualify names in my project with
the package name wherever possible, my httpd.conf needed not only

 PythonPath "['/path/to/directory/containing/my-project-dir']+sys.path"

but

 PythonPath "['/path/to/directory/containing/my-project-dir', 
'/path/to/my-project-dir']+sys.path"

Without it, the names of my apps would not be recognized without
qualification, and since according to the Django design these apps are
supposed to be pluggable into different Django projects, they /should/
be recognized that way.

Also I found other dependencies on the current working directory (I
build some pages from files in my filesystem), which I solved by 

  import os
  os.chdir('/path/to/my-project-dir')

in my settings.py.

I think that's a hack, but I don't know how to solve it better.
Between that and turning off the serving of site media through Django,
it means the settings.py and urls.py I run on my real server have to
differ from the ones I use on my development server.  I'm trying to be
disciplined about using source control for this, so I'd prefer to use
portable.  I guess I could set a special environment variable in my
httpd.conf, detect that in settings.py, and execute different code.
Better ideas anyone?

Finally, I had to explicitly specify a PostgreSQL user in my
settings.py file, because my apache runs as a different user (www)
than the one that created the database, and although I used
psql to

   GRANT ALL PRIVILEGES ON DATABASE "my.db" TO www;

I still couldn't get it to work until I set DATABASE_USER to "dave",
which is a PostgreSQL superuser (yikes!).  Since Django's nice model
API makes most knowledge of DB nitty-gritties obsolete, it would be
great if the docs could lend a helping hand over this particular
detail.

Thanks in advance,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to