> So, when you claim that permissions on directory where database is
> correct, what does that mean?
>
The directory and the sqlite db are chmoded to 664 and the owner of
both directory and db is apache:webdev
The creator of the db is tmo:webdev
The server runs with apache:apache, but is member of the webdev group
too

> What is the user/group that Apache runs as?
>
> What do you get for 'ls -las' on directory where database is?
>
r...@nas:/var/www/arc_en_ciel# ls -las sqlite/
total 28
 4 drwxrwxrwx 3 tmo webdev 4096 Mar 25 11:13 .
 4 drwxrwxr-x 9 tmo webdev 4096 Mar 25 10:06 ..
 4 drwxrwxrwx 6 tmo webdev 4096 Mar 25 01:28 .svn
12 -rwxrwxrwx 1 tmo webdev 9216 Mar 25 11:13 arcenciel.sqlite3
 4 -rwxrwxrwx 1 tmo webdev  973 Mar 25 03:25 init.sql


> Are all parent directories back up to root also readable by others?
>
yes

> Unless you have made everything writable by everyone, or run both
> Apache and webpy server as the same user, it is unlikely to work.
>
It's the case, I think.
r...@nas:/var/www/arc_en_ciel# ls -lad /var/
drwxr-xr-x 15 root root 4096 Jul 13  2008 /var/
r...@nas:/var/www/arc_en_ciel# ls -lad /var/www/
drwxrwxr-x 23 apache webdev 4096 Mar 25 01:22 /var/www/
r...@nas:/var/www/arc_en_ciel# ls -lad /var/www/arc_en_ciel/
drwxrwxr-x 9 tmo webdev 4096 Mar 25 10:06 /var/www/arc_en_ciel/
r...@nas:/var/www/arc_en_ciel# ls -lad /var/www/arc_en_ciel/sqlite/
drwxrwxrwx 3 tmo webdev 4096 Mar 25 11:13 /var/www/arc_en_ciel/sqlite/

> To be absolutely sure it isn't a database permissions problem, please
> answer the above with actual details.
>

What tells me too that it's not a db problem, is that I can do
inserts.
I've got a simple "log" table, just for testing the db
sqlite> .schema log
CREATE TABLE log(logid integer not null primary key AUTOINCREMENT, txt
text);
sqlite> select * from log;
sqlite>

Into my entry point code, I have added
    import datetime
    db.insert('log',txt='in log sqlite %s'%(datetime.datetime.now()))

and after the first try to access the page:
sqlite> select * from log;
52|in log sqlite 2009-03-25 11:18:04.067880

But:
sqlite> select * from sessions;
sqlite>

After a couple of reloads, I have:
sqlite> select * from log;
52|in log sqlite 2009-03-25 11:18:04.067880
53|in log sqlite 2009-03-25 11:19:19.253749
54|in log sqlite 2009-03-25 11:46:10.103165
55|in log sqlite 2009-03-25 11:46:11.187960
sqlite> select * from sessions;
sqlite>

I have issued an apachectl2 restart, restarted the browser and the
results are:
sqlite> select * from log;
52|in log sqlite 2009-03-25 11:18:04.067880
53|in log sqlite 2009-03-25 11:19:19.253749
54|in log sqlite 2009-03-25 11:46:10.103165
55|in log sqlite 2009-03-25 11:46:11.187960
56|in log sqlite 2009-03-25 11:47:50.882574
sqlite> select * from sessions;
sqlite>


> Am only pushing this as it is the most common cause of problems and
> your configuration doesn't show you running in daemon mode as
> yourself, which would be the preferred scenario.

I have to admit I've blindly followed the webpy tutorial on how
running webpy apps with mod_wsgi.
Reading about the daemon mode of mod_wsgi, I've almost haven't
understood anything of it.

I don't understand how to configure it, and which modifications I
should make to the script, if any...
I tried to declare my app as the wsgi gateway
WSGIScriptAlias / /var/www/arc_en_ciel/htdocs/base.py
But I get back an error:
[Wed Mar 25 12:02:31 2009] [error] [client 194.209.119.22] File does
not exist: /var/www/arc_en_ciel/htdocs/base.py/

The file is there though:
ls -lah /var/www/arc_en_ciel/htdocs/base.py
-rwxrwxrwx 1 tmo webdev 9.5K Mar 25 11:17 /var/www/arc_en_ciel/htdocs/
base.py

Sigh..
Days like this one make me really miss the ease of an PHP script
deployment...

> Graham
>
> On Mar 25, 6:56 pm, Thierry <[email protected]> wrote:
>
> > And for completness, here is my virtualhost apache config:
>
> > <VirtualHost *:80>
> > ServerName aec.dev
> > ServerAliaswww.aec.dev
> > DocumentRoot /var/www/arc_en_ciel/htdocs/
> > CustomLog /var/www/arc_en_ciel/log/access_log combined
> > ErrorLog  /var/www/arc_en_ciel/log/error_log
>
> > RewriteEngine on
> > RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
> > RewriteRule .* - [F]
>
> > include /etc/apache2/vhosts.d/expire
> > include /etc/apache2/vhosts.d/defRoot
>
> > <Files base.py>
> >   SetHandler wsgi-script
> >   Options ExecCGI FollowSymLinks
> > </Files>
> > </VirtualHost>
>
> > On Mar 25, 7:13 am, Thierry <[email protected]> wrote:
>
> > > Thanks for the advices.
> > > But sadly, it's not that.
> > > The sqlite parent folder perms are ok.
> > > After that mail, I created a "log" table, and made the script write it
> > > something on the first page loading, and it appears.
> > > Only the sessions table stay empty.
>
> > > Again, if  run it from the webpy server, the sessions appears in the
> > > session table, and everything works.
> > > I'm stumbled...
>
> > > On Mar 25, 4:19 am, Graham Dumpleton <[email protected]>
> > > wrote:
>
> > > > On Mar 25, 2:11 pm, Brent Pedersen <[email protected]> wrote:
>
> > > > > sqlite needs write permissions on the _directory_
> > > > > where the sqlite database is located and (r/write permissions)
> > > > > on the file itself.
>
> > > > > so after defining try:
>
> > > > > assert os.path.exists(self.finalDb), "db doesnt exist"
> > > > > assert os.access(self.finalDB, os.W_OK), "cant write to db file"
> > > > > assert os.access(self.dbPath, os.W_OK), "cant write to db directory"
>
> > > > > and see which on fails. then adjust permissions.
>
> > > > However, don't just go making the directories world writable. You are
> > > > better off running mod_wsgi daemon mode and run your application as
> > > > distinct user from Apache user, perhaps even yourself, such that it
> > > > has same access rights as yourself and can use the directories without
> > > > having to make them world writable or make the directories owned by
> > > > Apache user.
>
> > > > Also double check that your configuration isn't using a relative path
> > > > to stuff like the database. In Apache the current working directory
> > > > could be anything.
>
> > > > Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to