This project was created with Django 5.1.4 and Python 3.11.4
Install pipenv globally on your computer with:
pip install --user pipenvTo create a Python virtual environment for this project and install all dependencies from the Pipfile, run:
pipenv installTo activate it, run:
pipenv shellCreate a file named .env and fill it as the .env.example file indicates.
Create a secret key by running:
python utils/get_secret_key.pyTo execute all pending migrations, run:
python manage.py migrateThis project is set to work with SQLite by default, so the database will be created automatically on the folder of your project.
To set an super user admin profile for your application, run:
python manage.py createsuperuserFollow the steps on the terminal and the user will be created.
To serve the project on a port of your localhost, run:
python manage.py runserver-
The index route of the project will direct you to the API documentation generated by Swagger. All routes and endpoints are described and usable there.
-
Access the
/adminroute and login as the superuser you have created. There you will be able to manage the data for users and posts.
The tests in this project are managed with Pytest and it's integration with Django. Run pytest to run all tests.
For this implementation of the proposed challenge:
- The
Postmodel is fully integrated with theUsermodel. - Only authenticated users can create new posts.
- Only the owners of a post have permission to edit or delete it.
- All posts are visible to any user, authenticated or not, through the
GETmethod.
This approach was chosen to add complexity to the project and display my abilities in data association and authentication in general, including the use of JSON Web Tokens for user login.