Important parts of your code¶
Most of the time, one function should be the entry point of your application. In
this instance, I use C as an inspiration for standardizing the use of the
main.main()
function. As python file names matter - in contrast to C -
the module holding the main() function is also called main
.
If you are calling the python interpreter directly on a file, then you’ll need to add a safeguard:
if __name__ == '__main__':
main()
Otherwise, the function is usually given as a gateway, for example if using gunicorn to start a server and deliver a flask application:
$ gunicorn app.main:main
Warning
The entire project is built using Python 3.7+, and in such an example, gunicorn or any other server needs to be carefully setup to use Python 3 as - at the time of this writing - most operating systems and platforms still operate with Python 2.7 as a default.