[web2py] Re: Create databases folder
yes. Except on GAE. Is it not? On Feb 4, 11:36 am, Thadeus Burgess thade...@thadeusb.com wrote: Isn't web2py supposed to create the databases, sessions, uploads, etc folders if they don't exist? -- Thadeus
[web2py] Re: Create databases folder
If migrate is True on your Fields then web2py will want to have the databases directory existing first as it tries to open databases/ sql.log first. If this directory doesn't exist then an exception is thrown. web2py$ ls -FC applications/newapp/ ABOUT __init__.py controllers/ languages/ modules/views/ LICENSE cache/ cron/ models/ static/ wizard.metadata web2py$ python web2py.py -S newapp -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.91.6 (2011-02-01 17:13:19) Database drivers available: SQLite3, pymysql, PostgreSQL Traceback (most recent call last): File /Users/grutz/src/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File applications/newapp/models/db.py, line 80, in module auth.define_tables(migrate=settings.migrate) # creates all needed tables File /Users/grutz/src/web2py/gluon/tools.py, line 1198, in define_tables format = '%(role)s (%(id)s)') File /Users/grutz/src/web2py/gluon/dal.py, line 3490, in define_table polymodel=polymodel) File /Users/grutz/src/web2py/gluon/dal.py, line 522, in create_table logfile = self.file_open(table._loggername, 'a') File /Users/grutz/src/web2py/gluon/dal.py, line 359, in file_open fileobj = open(filename,mode) IOError: [Errno 2] No such file or directory: 'applications/newapp/ databases/sql.log' web2py$ mkdir applications/newapp/databases web2py$ python web2py.py -S newapp -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.91.6 (2011-02-01 17:13:19) Database drivers available: SQLite3, pymysql, PostgreSQL Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) Type copyright, credits or license for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. In [1]:
Re: [web2py] Re: Create databases folder
I know. I thought that this had been patched in web2py, and I was just wondering the feature got lost in the translation to the new DAL. -- Thadeus On Fri, Feb 4, 2011 at 4:16 PM, Kurt Grutzmacher gr...@jingojango.netwrote: If migrate is True on your Fields then web2py will want to have the databases directory existing first as it tries to open databases/ sql.log first. If this directory doesn't exist then an exception is thrown. web2py$ ls -FC applications/newapp/ ABOUT __init__.py controllers/ languages/ modules/views/ LICENSE cache/ cron/ models/ static/ wizard.metadata web2py$ python web2py.py -S newapp -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.91.6 (2011-02-01 17:13:19) Database drivers available: SQLite3, pymysql, PostgreSQL Traceback (most recent call last): File /Users/grutz/src/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File applications/newapp/models/db.py, line 80, in module auth.define_tables(migrate=settings.migrate) # creates all needed tables File /Users/grutz/src/web2py/gluon/tools.py, line 1198, in define_tables format = '%(role)s (%(id)s)') File /Users/grutz/src/web2py/gluon/dal.py, line 3490, in define_table polymodel=polymodel) File /Users/grutz/src/web2py/gluon/dal.py, line 522, in create_table logfile = self.file_open(table._loggername, 'a') File /Users/grutz/src/web2py/gluon/dal.py, line 359, in file_open fileobj = open(filename,mode) IOError: [Errno 2] No such file or directory: 'applications/newapp/ databases/sql.log' web2py$ mkdir applications/newapp/databases web2py$ python web2py.py -S newapp -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.91.6 (2011-02-01 17:13:19) Database drivers available: SQLite3, pymysql, PostgreSQL Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) Type copyright, credits or license for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. In [1]:
[web2py] Re: Create databases folder
As Jonathan says, it is main that creates the missing folders, the first time the app is accessed. dal just assumes it is there. On Feb 4, 4:56 pm, Jonathan Lundell jlund...@pobox.com wrote: On Feb 4, 2011, at 1:19 PM, Thadeus Burgess wrote: Nope not working for me. A raw checkout of a branch, there is no NEWINSTALL file, nor a welcome.w2p file since we don't need it. The app only contains controllers, cron, languages, models, modules, static, tests, views, __init__.py. From this state, when starting web2py just by python web2py.py. Navigate to the app in firefox or other web browser, and it crashes because it cannot connect to the sqlite database 5 times, this is because the databases folder does not exist from a raw checkout of our app, and web2py does not seem to be creating any of the folders. If I navigate into my app directory, and run ``mkdir databases`` then navigate to the app, everything is fine, and web2py ends up making the uploads, private, cache, sessions, and errors folders. Odd. The admin.create_missing_app_folders() call in main.wsgibase should be creating the folder. Could you throw a couple of strategic debug prints into that function and see what's going on?
Re: [web2py] Re: Create databases folder
I will add debugging to find out next time I am working on it. -- Thadeus On Fri, Feb 4, 2011 at 7:11 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: As Jonathan says, it is main that creates the missing folders, the first time the app is accessed. dal just assumes it is there. On Feb 4, 4:56 pm, Jonathan Lundell jlund...@pobox.com wrote: On Feb 4, 2011, at 1:19 PM, Thadeus Burgess wrote: Nope not working for me. A raw checkout of a branch, there is no NEWINSTALL file, nor a welcome.w2p file since we don't need it. The app only contains controllers, cron, languages, models, modules, static, tests, views, __init__.py. From this state, when starting web2py just by python web2py.py. Navigate to the app in firefox or other web browser, and it crashes because it cannot connect to the sqlite database 5 times, this is because the databases folder does not exist from a raw checkout of our app, and web2py does not seem to be creating any of the folders. If I navigate into my app directory, and run ``mkdir databases`` then navigate to the app, everything is fine, and web2py ends up making the uploads, private, cache, sessions, and errors folders. Odd. The admin.create_missing_app_folders() call in main.wsgibase should be creating the folder. Could you throw a couple of strategic debug prints into that function and see what's going on?