some good practices to adopt with ,, mm `7MM MM MM `7MMpdMAo.`7M' `MF'mmMMmm MMpMMMb. ,pW"Wq.`7MMpMMMb. MM `Wb VA ,V MM MM MM 6W' `Wb MM MM MM M8 VA ,V MM MM MM 8M M8 MM MM MM ,AP VVV MM MM MM YA. ,A9 MM MM MMbmmd' ,V `Mbmo.JMML JMML.`Ybmd9'.JMML JMML. MM ,V .JMML. OOb" published: 02/09/21 (dd/mm/yy) updated: not yet Here's some good practices that I follow whenever I work with Python: * do not use pip, flask or other commands directly! use this: python3 -m [module name] (see https://adamj.eu/tech/2020/02/25/use-python-m-pip-everywhere/ for more informations) If a python module do not work using the `python3 -m` command, search for your function in a file, and call it directly (not a `good` practice, but might work): example: `python3 -m invoice2data.main` works, and `python3 -m invoice2data` does not work :/ * there's no need to use virtualenv or another package, stick with venv: python3 -m venv .venv . .venv/bin/activate [do stuff] deactivate * .env files are great (do not forget to add them to your .gitignore!), fun dev starts once you have (at least) those two lines in it: cat .env > export DJANGO_SETTINGS_MODULE=website.settings.dev > export PYTHONPATH=/var/www/python/website/src . .venv/bin/activate source .env python3 manage.py runserver 0.0.0.0:8000^C deactivate * pipenv seems cool until it hangs for 2 hours, pinning and re-pinning the sames modules (https://pipenv.pypa.io/en/latest/) * same for poetry, but slightly better (https://python-poetry.org/) * see this ugly gist if you're willing to create a django+django-cms+djangocms-blog website for dev purposes: https://gist.github.com/corentinbettiol/69601ea572d6eb162ec8e838f1f923ba