Remember to take the fake_migrate_all=True away once you have you database metadata in databases/ dir in place and the app is accessing all the tables. You need it only when you make the first request.
Il giorno lunedì 21 dicembre 2015 01:25:47 UTC+1, Ben Lawrence ha scritto: > > > HI, > This is not a question, but just some information for any one with not > much experience in postgres (like me). > > Problem: > Dump database from postgresql on one server and restore it on another. > > Solution: > Assuming your appconfig.ini is > uri = postgres://web2py:password@localhost:5432/databasename > migrate = 1 > pool_size = 1 > then export in your terminal, type > sudo pg_dump databasename -U web2py -h localhost > database.sql > I used git to transfer this file to the new server. > On the new server, first create empty database: > sudo -u postgres psql postgres > postgres=# create user web2py with password ‘password’; > CREATE ROLE > postgres=# create database databasename; > CREATE DATABASE > postgres=# grant all privileges on database databasename to web2py; > GRANT > postgres=# \q > next, import database into postgresql, type this in your terminal: > sudo psql -U web2py -h localhost -d databasename < database.sql > Now, before you do anything, make sure that in web2py’s db.py you have: > db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', > cast=int), check_reserved=['all'],fake_migrate_all=True) # > fake_migrate_all=True is the important bit > Also, in your appconfig.ini it is the same as above. > I got some warnings about "public" during the import, but I ignored them. > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.