On Aug 12, 3:43 pm, consiglieri <apelsi...@gmail.com> wrote:
> Thanks Graham!
>
> The absolute path was the issue. Can't believe I couldnt find that
> anywhere.
>
> As for the Alias, well i was just testing to make sure that wasnt an
> issue.And its in the httpd.conf , for perl-cgi you need that so since
> i was having issues i decided to try and see if it was causing my
> issues. (Which it wasnt). As the apaches conf says
>
>     # ScriptAlias: This controls which directories contain server
> scripts.
>     # ScriptAliases are essentially the same as Aliases, except that
>     # documents in the target directory are treated as applications
> and
>     # run by the server when requested rather than as documents sent
> to the
>     # client.  The same rules about trailing "/" apply to ScriptAlias
>     # directives as to Alias.
>
> So i was thinking maybe i need to set an alias so that apache executes
> the python scripts.
>
> The only thing i have noted now is that that when i go to the admin
> url the css doesnt seem to follow but probably its just a sethandler
> issue.

For mod_python it is a bit of a fiddle for getting static files to be
served if logically under mount point of mod_python hosted
application. As you say, you need to disable mod_python for the URLs
using 'SetHandler None'. FWIW, mod_wsgi is a lot more saner in this
respect as it respect resource stuff and so an Alias is enough to have
static files mounted. For more details of using mod_wsgi instead of
mod_python see:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

The mod_wsgi module also will make it easier for you if developing
code under Apache, as you can use daemon mode and just touch WSGI
script file to trigger a reload, or setup a code monitor so it behaves
just like Django development server. For more details on code
reloading in mod_wsgi see:

  http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

Graham

> Anyway Graham I really appreciate your input. At least now i know my
> setup is working and I ca get on with actually developing the app
> better as well as trying to master the django framework
>
> Thomas
>
> On 12 Aug, 00:02, Graham Dumpleton <graham.dumple...@gmail.com> wrote:
>
>
>
> > For SQLite database, the directory the database is in must also be
> > writable to user that Apache runs as. The location of the database in
> > settings file must also be an absolute path, can't use a relative
> > path.
>
> > BTW, what is:
>
> >   Alias test.django.com "/Users/someone/djangoproject/appname"
>
> > for in configuration? It will have no effect and normall your wouldn't
> > have anything like that in configuration for Django.
>
> > Graham
>
> > On Aug 12, 4:45 am, consiglieri <apelsi...@gmail.com> wrote:
>
> > > Thanks for the tip, however it does not make a difference. I moved the
> > > app to another catalogue and made sure that the database file was
> > > chmod to 755 and also that all directories have the same permissions.
> > > The error remains.
>
> > > There is something happening that i dont understand. I'm beginning to
> > > think there is someting wrong with the django or mod_python
> > > installation but i am at a loss understanding what it can be.
>
> > > Thomas
>
> > > On 11 Aug, 19:04, Mike Ramirez <gufym...@gmail.com> wrote:
>
> > > > On Tuesday 11 August 2009 09:43:38 am consiglieri wrote:
>
> > > > > Hi
>
> > > > > I'm new with django and have made a small test app which works as it
> > > > > should with the development server.
>
> > > > > However when i try and deploy it with apache and mod_python I cant get
> > > > > it to work. I have tested that mod_python works. I can do the
> > > > > recommended mod_python test. When i try to run the django app via
> > > > > apache it works well as long as the page being displayed does not
> > > > > actually try and access the database. In other words if I enter a url
> > > > > that just pops up an empty page with no django tags in it the page is
> > > > > displayed as it should.
>
> > > > > These are my settings.
>
> > > > > Apache 2.2.11
> > > > > mod_python 3.3.2-dev
> > > > > I am on a Mac (Leopard 10.5.8)
> > > > > I have the latest stable version of django 1.1
>
> > > > > When I start apache the following can be found in the logs
>
> > > > > Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 mod_python/
> > > > > 3.3.2-dev-20080819 Python/2.5.1 configured -- resuming normal
> > > > > operations
>
> > > > > The necessary settings in httpd.conf with regards to django is as
> > > > > follows
>
> > > > > Alias test.django.com "/Users/someone/djangoproject/appname"
>
> > > > > SetHandler python-program
> > > > > PythonHandler django.core.handlers.modpython
> > > > > SetEnv DJANGO_SETTINGS_MODULE appname.settings
> > > > > PythonDebug On
> > > > > PythonPath "['/Users/someone/djangoproject/'] + sys.path"
>
> > > > > When i run a url that invokes a function which tries to access the
> > > > > database (sqlite3 in this case) i receive the following error
>
> > > > You have to make sure the database file is also readable and writeable 
> > > > by the
> > > > user apache is running as.  The leading path should also be readable to 
> > > > the
> > > > apache user.  755 settings on the directories in the tree.  
>
> > > > Some ways of fixing this are making a group; say djangodevs and add 
> > > > both your
> > > > user and the apache user to that group and setting the sqlite file to be
> > > > rwxrwx---.
>
> > > > You could run apache as your user by changing the User/Group setting in 
> > > > your
> > > > httpd.conf/apache2.conf (see sample below) or a variation of this with 
> > > > the
> > > > above suggestion.
>
> > > > # User/Group: The name (or #number) of the user/group to run httpd as.  
> > > >     
> > > > #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".              
> > > >     
> > > > #  . On HPUX you may not be able to use shared memory as nobody, and 
> > > > the    
> > > > #    suggested workaround is to create a user www and use that user.    
> > > >     
> > > > #  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)    
> > > >     
> > > > #  when the value of (unsigned)Group is above 60000;                    
> > > >     
> > > > #  don't use Group #-1 on these systems!                                
> > > >     
> > > > #                                                                       
> > > >    
> > > > User youruser                                                           
> > > >    
> > > > Group youruser
>
> > > > I would personally recommend that you store your project files outside 
> > > > of your
> > > > home directory, I believe/assume /Users/someone/ is your home 
> > > > directory. I
> > > > would use something like /srv/djangoproject and configure the settings 
> > > > so
> > > > both your user and the apache user can read write to the files through 
> > > > the
> > > > group settings.
>
> > > > With a database like mysql/postgres that you connect to over a network 
> > > > you
> > > > wouldn't need to worry about this since they have their own login.  
>
> > > > Mike
>
> > > > > TemplateSyntaxError at /appname/clients/
> > > > > Caught an exception while rendering: no such table:
> > > > > addressbook_contacts
>
> > > > > Original Traceback (most recent call last):
> > > > >   File "/Library/Python/2.5/site-packages/django/template/debug.py",
> > > > > line 71, in render_node
> > > > >     result = node.render(context)
> > > > >   File "/Library/Python/2.5/site-packages/django/template/
> > > > > defaulttags.py", line 126, in render
> > > > >     len_values = len(values)
> > > > >   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> > > > > line 81, in __len__
> > > > >     self._result_cache = list(self.iterator())
> > > > >   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> > > > > line 238, in iterator
> > > > >     for row in self.query.results_iter():
> > > > >   File "/Library/Python/2.5/site-packages/django/db/models/sql/
> > > > > query.py", line 287, in results_iter
> > > > >     for rows in self.execute_sql(MULTI):
> > > > >   File "/Library/Python/2.5/site-packages/django/db/models/sql/
> > > > > query.py", line 2369, in execute_sql
> > > > >     cursor.execute(sql, params)
> > > > >   File "/Library/Python/2.5/site-packages/django/db/backends/util.py",
> > > > > line 19, in execute
> > > > >     return self.cursor.execute(sql, params)
> > > > >   File "/Library/Python/2.5/site-packages/django/db/backends/sqlite3/
> > > > > base.py", line 193, in execute
> > > > >     return Database.Cursor.execute(self, query, params)
> > > > > OperationalError: no such table: addressbook_contacts
>
> > > > > Now i know for a fact that the database does contain a table called
> > > > > contacts. I have no problems whatsoever accessing this using the
> > > > > development server.
>
> > > > > As far as I can tell django seems unable to access the database when
> > > > > going through apache and mod_python.
> > > > > I have googled and I have searched to no avail. If anyone can give me
> > > > > a helping hand I would appreciate it very much.
>
> > > > > Thanks.
>
> > > > --
> > > > I hate babies.  They're so human.
> > > >                 -- H.H. Munro
>
> > > >  signature.asc
> > > > < 1KVisaHämta
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to