A simple articles web application built with django + htmx + Bootstrap. (learning django)
- Clone git repository
- (Optional) Create a Python virual environment and activate it (py version in runtime.txt)
- Install requirements
- Change directory to src
- Make migrations and migrate
- Run server
$ git clone https://github.com/stefanoandroni/mysite-django
$ cd mysite-django
$ pip install -r requirements.txt
$ cd src
$ py manage.py makemigrations
$ py manage.py migrate
$ py manage.py runserver
- Create an admin user
- Register as a user in
'/accounts/register'
and login
$ python manage.py createsuperuser
'mysite' is the project root directory.
Note The endpoints for htmx requests (not accessible) and for static files are not included
/accounts /login /logout /register /password-change
/articles / /create Create /list Retrieve (List) /<slug:article_slug> / Retrieve (Detail) /<slug:article_slug> /update/ Update /<slug:article_slug> /delete/ Delete
/profiles /
/articles /search
- Views were initially implemented as FBV (Function Based Views), to then be (almost totally) converted to CBV (Class Based Views).
- A custom middleware has been implemented.
- Article pages load on click ('Click To Load'). (implemented with django pagination and Htmx)
- Article images are automatically cropped on upload (fixed aspect ratio). (implemented with the Pillow library)
- Environment variables are loaded from an .env file. (implemented with the dotenv module)
- Simple test_models have been implemented for the articles app, executable from the command line:
$ py manage.py test articles