Show Menu

Django - heliophost Cheat Sheet (DRAFT) by

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


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­

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 to c:\python\mywork
4 cd c:\python\mywork
5 copy hello\dispatch.wsgi hello\
6 python runserver
8 upload hello proj to and run
--> 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 this is the app business logic

python­-flask -mysql web app

Setting Up Flask: 
   pip install flask> create home dir > python > 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: 
   def showSi­gnUp(): 
       return render­_te­mpl­ate­('s­ign­up.h­tml')