3 ms·
A bunch of my own opinions to the FAQ: - Should I use Flask or Django? - Agreed, Django - Should I split my code up into multiple apps? - I think it's better
by spapas82 8y ago
A bunch of my own opinions to the FAQ:
- Should I use Flask or Django?
- Agreed, Django
- Should I split my code up into multiple apps?
- I think it's better if you split your code into different apps from the beginning especially if its about different things that don't have a heavy relations. For example I usually put my user, profile, preferences etc things in a different app.
- Should I use Django’s default template language (DTL) or something else?
- Agreed, DTL
- DTL doesn’t do what I want - should I use something else like Jinja2?
- Agreed, use DTL and mix a bunch of template tags for things that can't be implemented with only the DTL
- Should I use Gunicorn or uWSGI to run Django?
- Agreed, definitely use gunicorn unless you really know what you are doing. uWSGI is a PITA to setup and has various problems with security, when reloading it etc
- Where should I deploy my app?
- No opinion I mainly deploy to internal (Centos) servers
- What should I use to serve my static files?
- Whitenoise is a good solution for some projects but if you are going to put your app behind a reverse proxy (i.e nginx) then why not just serve your static files from there directly ?
- I’m trying to get the admin to do X…
- Agreed, admin is for internal users / operators; CBV is excellent. Also if you want something more configurable try my django generic scaffold package: https://github.com/spapas/django-generic-scaffold/ https://github.com/spapas/django-generic-scaffold/
- What database should I use?
- Agreed, Postgres all the way; don't forget to take a look at the django-postgresql specific models https://docs.djangoproject.com/en/2.1/ref/contrib/postgres/fields/ https://docs.djangoproject.com/en/2.1/ref/contrib/postgres/f...
- How should I split my settings file between production / development?
- I disagree; I use the common pattern with a settings package and dev/uat/prod modules. Using env vars is not always feasible since python is much more expressive than a string (think when you need to setup a setting with a dict)
- Should I use a custom User model?
- Agreed; follow the docs if you start from scratch but be careful if you have a project with live migrations