Flask - Part C

revised: 23-Dec-2021

Prerequisites: A Flask-enable environment on the PC with a 'myapp' folder - which, via an FTP client (eg.FileZilla), can be synchronized with the 'myapp' folder on the server. Both PC and Server can test, via http on port:5000 (eg. localhost:5000 and http://MySeverIP:5000) respectively.

Part C1. Building a simple Flask Framework
reference: Flask

In the 'myapp'folder, the framework below is to take on this Flask module-type application:
   myproject.ini // needed for server only
   wsgi.py // needed for server only


The contents of the 'myapp' folder, as stated in the introduction, can be downloaded here and the modified version with a mail form here (mail enhanced). With the content thus extracted that replaces the project.py file and adds other folders in the 'myapp' folder on the PC, open the console (via 'PowerShell'[Win10] or in Win 7+, typing in 'cmd')and enter these commands:

cd Documents\Scripts\myapp
ipython myproject.py

Enter in the browser, type in this url: localhost:5000 (eg. http://localhost:5000), the three page Flask website should appear. Type in the console: 'ctl'+c to exit.

Part C2: Synchronize Site with the Server

Using a FTP client (eg. FileZilla), one cam logon on the server as the regular user (eg. sammy), via PuTTY, and, with respect to the 3-page Flask app,
(Step#1)transfer: the myproject.py and the two directoryies; static and templates.
Then logon on to the server and as user:sammy, issue the following commands:

sammy@imega:$ cd ~/myapp
sammy@imega:~/myapp$ . venv/bin/activate // 'deactivate' to stop
(myvenv) sammy@imega:~/myapp$ ipython myproject.py

(Step#2)With the browser: Enter one's domain at port:5000 (eg. http://example.com:5000), the same three page Flask website should appear. Use the key-combo 'ctl'+c to exit.

Having reach this point, one can note that doing all the trouble-shooting and changes first on the PC based Flask site so that it functions well, only then, via Filezilla, one would transfer the updated files to the server -- keeping the two synchronized.
It is worthwhile to read and familiarize oneself about Flask as well as to make changes in the three html pages (index, aboutus and contactus.html)to conform to your own content.

Flask Flask-PartB
Flask-PartC Flask-PartD