Show Menu
Cheatography

Django - heliophost Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Helioh­ost.org

Helioh­ost.org,
taotal.he­lio­hos­t.o­rg/­fla­sk/­mys­qldemo
python 3.7, flask 1.1.1, java, mysql
mysql connec­ton­:jd­bc:­mys­ql:­//l­oca­lho­st:­330­6/myDB, for remost db, using tommy.h­el­ioh­ost.org

setup python django proj

1 dowload python 3.6.3 (tommy) and install to c:\python\python36
2 pip install django==2.1.4 (tommy) 
python -m django --version
3 pip install cookiecutter, download cookiecutter-helio-master.zip to c:\python\mywork
4 cd c:\python\mywork
cookiecutter cookiecutter-helio-master.zip
5 copy hello\dispatch.wsgi hello\wsgi.py
6 python manage.py runserver
7 http://127.0.0.1:8000
8 upload hello proj to heliohost.org and run taotao.heliohost.org/hello
--> done

Python flask demo

1 Create a folder in public­_html called flask: /home/­use­rna­me/­pub­lic­_ht­ml/­flask/
2 create a .htaccess
3 Create a file named flask.w­sgi: web server gatewau interface
4 Create a python script named myapp.py: this is the app business logic

python­-flask -mysql web app

Setting Up Flask: 
   pip install flask> create home dir
   app.py > python app.py > http:/­/lo­cal­hos­t:5000
Creating a Home Page: 
   index.html > in main(): return render­_te­mpl­ate­('i­nde­x.h­tml')
Setup mysql database: create db, table, procedure
Create ../tem­pla­tes­/html form, ../sta­tic­/.css,python route: 
   @app.r­out­e('­/sh­owS­ignUp') 
   def showSi­gnUp(): 
       return render­_te­mpl­ate­('s­ign­up.h­tml')