A smooth sea never made a skilled sailor. – Franklin D. Roosevelt
Hi Pythonistas, a new week, a new ‘bite’ of Python coding! We are 2 weeks into learning Django (our second 100 Days project) so we thought it’s about time to dedicate a code challenge to it. So this week is all about coding (and deploying) a Django app. Have fun!
The challenge
Similar to our first Flask challenge we ask you to build a simple app with the following requirements:
Basic
- Data gets stored and queried using Django’s ORM (which uses SQLite by default, but feel free to use another DB).
- Separate content from presentation, however Django should enforce that as it follows the MVC pattern (or more correctly: the MTV pattern).
Don’t be shy
- Data can be added, edited and deleted (CRUD)
Die hard
- Add a login. Note that Django comes with batteries included so you might be able to leverage the existing User model (
from django.contrib.auth.models import User
) – this article might be helpful. - If you want to go overboard, add a registration system: signup form + confirmation link validation email + password reset function. Simpleisbetterthancomplex.com has tutorials on this too. Or maybe you can leverage a plugin?
Bonus
- Deploy your app to Heroku, Python Anywhere or a service of your choice.
Resources
- Django docs – Django has high quality documentation, use it 🙂
- Writing your first Django app (polls) tutorials – we found these helpful getting started.
- Full Stack Python Django reference page.
- First Steps Learning Django: PyPlanet Article Sharer App – article how we built our first app.
- For deployment use the provider’s latest docs. Last week we learned some Heroku and Python Anywhere ourselves.
- Books: Django Unleashed / The Django Book.
Getting ready
See our INSTALL doc how to fork our challenges repo to get cracking.
This doc also provides you with instructions how you can submit your code to our community branch via a Pull Request (PR). We will feature your PRs in our end-of-the-week challenge review (previous editions).
Feedback
If you have ideas for a future challenge or find any issues, open a GH Issue or reach out directly.
Last but not least: there is no best solution, only learning more and better Python. Good luck!
Keep Calm and Code in Python!
— Bob and Julian