dvenkatr / blog-project

Basic blog to play around with Django
0 stars 0 forks source link

Missing best practices #1

Open yudistrange opened 3 years ago

yudistrange commented 3 years ago

Python Version

The readme doesn't specify which python version to use for the app. Is it 2.7 or 3.x. If it's 3.x what's the minimum version of python 3 that can run this app?

Frozen Dependency list

The project doesn't list any of the libraries it depends on. I got it to work by installing django but the version information is missing as well.

I presume you used pip to install django. If so you can do pip freeze to list all the current dependencies (and you should probably paste that into a file and check it in to git. The convention is to call is requirements.txt)

But pip has been around for decades(?) now. You should probably use poetry which is the new shiny dependency management tool for python.

Slight detour

Another thing I can't recommend enough is setting up virtualenvs, one per project ideally. By default all dependencies are installed globally. If different projects which require different version of dependencies, then you are in a fix. virtualenv tries to counter that by segregating the deps. You can also control the version of python / pip without having to change the system python installation.

Segregated models and views

There is only one model and view file. For the current scope of the project that's fine. But when you start adding more models / views or even more functionality, you would need to separate them into individual files

dvenkatr commented 3 years ago

Thanks for the comments, @yudistrange