how to initialize PostgreSQL database in openshift only once -


To design my flask postgrascled based app, I want to start my database with some items, Created for manage.py This is because I want to enter the item in the database only once. After that, I want to go normally (git push my project) my project works fine, i do not know how to manage me how to manage and how should i use it as admin or make sure Do this just run once, I use manage.py as python manage.py create_tables.

This is my wsgi folder:

  ├── app.py ├── auth Py ├── flaskapp.cfg ├── forms.py ├── ├── ├── ├── ├── ├── ├── ├── ├── ├── ├── ├── ├─ ├─ ─ ├── ├── ├── ├── ├── template │ ├── base.html │ ├── evaluate.html │ └── show_all.html └── views.py  

and this is my project folder:

  manage.py readme.md requirements.txt setup .py venv wsgi wsgi.py  

Obviously, I want to initialize the database in such a way that every time I change the code and Push, I do not want to restart the database with the same entries but only when I want and as an administrator too.

This is my application file:

  #! / Usr / bin / python import os virtenv = Os.environ ['OPENSHIFT_PYTHON_DIR'] + '/ virtenv /' os.environ ['PYTHON_EGG_CACHE'] = os.path.join (virtenv, 'lib / python2.7 / site- Packages') virtualenv = Os.path.join (virtenv, 'bin / activate_this.py') Try: Exclude execfile (virtual, word (__ file __ = virtualenv)) IOError: pass # # Important: Include below the line. If it is placed above the # line, then it is necessary that your libraries can not be made from the main import app as the # main import app - application from main import * db.create_all ()  

Openshift is not well documented and it is not clear what is the right place to start a database at a time.

"post-text" itemprop = "text">

this file. Posted in:

  source $ OPENSHIFT_HOMEDIR / python / virtenv / bin / active python "$ OPENSHIFT_REPO_DIR" wsgi / manage.py  

/ Pre>

This script will manage your application every time.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -