Reputation: 225
I'm trying to deploy my first Django app using OpenShift. So far everything is working smoothly except when I get to adding my database.
From this article I found that I should be storing the database in the data directory (e.g. appname > data > database.db).
My settings.py includes:
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os.path.join(os.environ['OPENSHIFT_DATA_DIR'], 'sqlite3.db'), # Or path to database file if using sqlite3.
Which looks good. When I get my error, I see the path:
'/var/lib/openshift/515ccff04382ec2acd00014c/app-root/data/sqlite3.db'
Which also looks good. But I still get the error:
no such table: openshift_inventories
Now, I have added the table to the db, but is there some special syncdb command or some such that I have to run instead of just pushing this online? Major newbie here. I learned what the words 'commit' and 'push' were today. I appreciate any thoughts y'all have.
Best, Brett
Upvotes: 2
Views: 3393
Reputation: 3526
This blog post will probably help you.
http://appsembler.com/blog/django-deployment-using-openshift/
You will see in the post that he adds the syncdb commands to the commit hooks.
Please note his instructions apply to the 2.6 cartridge, the setup will be different for the 2.7 and 3.3 cartridges because of changes to the way we set up the virtual environment.
Upvotes: 2