วันศุกร์ที่ 22 กันยายน พ.ศ. 2560

Turbogears 2.3 on Heroku

Turbogears 2.3 on Heroku

Step 1 : Install waitress
pip install waitress


Step 2 : Install turbogears app
gearbox quickstart myproturbo


Step 3 : Change to project
cd myproturbo


Step 4 : Create file requirements.txt  in project
pip freeze > requirements.txt
 *** Open file requirements.txt and delete your project which you setup in python environment ex:

myproturbo=0.1  [your project: setup.py develop]
or
-e git+https://github.com/xxxxxxxxx#egg=xxxx  [your project: from git or subversion]


Step 5 : Add -e . in last row in file  requirements.txt

alembic==0.9.5
babel==2.5.1
backlash==0.1.2
beaker==1.9.0
crank==0.8.1
decorator==4.1.2
formencode==2.0.0a1
funcsigs==1.0.2
gearbox==0.1.1
kajiki==0.7.1
mako==1.0.7
MarkupSafe==1.0
nine==1.0.0
PasteDeploy==1.5.2
Pygments==2.2.0
python-dateutil==2.6.1
python-editor==1.0.3
pytz==2017.2
repoze.lru==0.7
repoze.who==2.3
six==1.11.0
speaklater==1.3
sprox==0.10.2
sqlalchemy==1.2.0b2
Tempita==0.5.2
tg.devtools==2.3.11
tgext.admin==0.7.4
tgext.crud==0.8.2
tgext.debugbar==0.3.0
transaction==2.1.2
TurboGears2==2.3.11
tw2.core==2.2.4
tw2.forms==2.2.5
waitress==1.0.2
webhelpers2==2.0
WebOb==1.7.3
WebTest==1.4.3
zope.interface==4.4.2
zope.sqlalchemy==0.7.7
-e .


Step 6 : copy development.ini to production.ini
cp  development.ini production.ini


Step 7 : change  config file in production.ini
[server:main]
use = egg:gearbox#wsgiref
host = 0.0.0.0
port = 8080

Change to

[server:main]
use = egg:waitress#main
host = 0.0.0.0
get port = heroku_port



Step 8 :  Generate file Procfile to start app

echo "web: /app/.heroku/python/bin/gearbox serve --debug -c production.ini heroku_port=$PORT" > Procfile

*** file name is Case-sensitive


Step 9 : Prepaire and Setup git repo
wget -O .gitignore https://raw.github.com/github/gitignore/master/TurboGears2.gitignore
git init
git add .
git commit -m "initial commit"


Step 10 : Initialize keroku project
heroku create myproturbo


Step 11 : Deploy to heroku
git push heroku master

remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote:        Obtaining file:///tmp/build_c1da74e071cabdd181483ce0164e3a85 (from -r /tmp/build_c1da74e071cabdd181483ce0164e3a85/requirements.txt (line 40))
remote:        Installing collected packages: myproject
remote:          Running setup.py develop for myproject
remote:        Successfully installed myproject
remote:
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 55.7M
remote: -----> Launching...
remote:        Released v7
remote:        https://myproturbo.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/myproturbo.git
   8b92553..d19a8fa  master -> master


Step 12 : Check status heroku
heroku logs -t


You can see : https://myproturbo.herokuapp.com/
My github :  https://github.com/tongpa/myproject.git

turbogear : http://turbogears.readthedocs.io/en/latest/cookbook/deploy/heroku.html




ไม่มีความคิดเห็น:

แสดงความคิดเห็น

Turbogears 2.3 on Heroku

Turbogears 2.3 on Heroku Step 1 : Install waitress pip install waitress Step 2 : Install turbogears app gearbox quickstart myproturb...