👨💻
djangoblog
A blogging platform built on Django and Python – deployable with PythonAnywhere.com.
Functionality
A list of existing and planned functionality for my DjangoBlog project.
- Build models for article content and link with Django admin console
- Ability to publish posts via the admin console
- Publish new posts via a webform
- Edit existing posts
- Hide the edit functionality for non-authenticated users
- Add tests for requesting index page
- Add tests for requesting an individual post's page
- Add tests for submitting an edit
- Add tests for posting via webform
- CI/CD using GitHub Actions
- Function to create draft posts
- Additional security via Django decorators and login url
- Add comment function
Django Basics
Running the server
The Django server is started via the runserver command.
python3 manage.py runserver
Initialising the Admin Panel with a user
python3 manage.py createsuperuser
PythonAnywhere
Updating static files (e.g. CSS) must be done manually via the PythonAnywhere bash console using the following command:
python3 manage.py collectstatic
Once you have a user setup, you can access Django's awesome Admin panel at /admin/
. For added security this url can be changed to something more obscure via /mysite/urls.py
Adding models to the database
When creating a new Django project, you must create a models.py file. This file contains the database models. Any additions to the models.py file will only be reflected in the database if you run the following commands:
python3 manage.py makemigrations blog
python3 manage.py migrate blog