Skip to content

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

CodeLeap Network

This project was created with Django 5.1.4 and Python 3.11.4

Create a virtual environment

Install pipenv globally on your computer with:

pip install --user pipenv

To create a Python virtual environment for this project and install all dependencies from the Pipfile, run:

pipenv install

To activate it, run:

pipenv shell

Create your environment variables

Create a file named .env and fill it as the .env.example file indicates.
Create a secret key by running:

python utils/get_secret_key.py

Run Migrations

To execute all pending migrations, run:

python manage.py migrate

This project is set to work with SQLite by default, so the database will be created automatically on the folder of your project.

Create Super User

To set an super user admin profile for your application, run:

python manage.py createsuperuser

Follow the steps on the terminal and the user will be created.

Run the application

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 /admin route and login as the superuser you have created. There you will be able to manage the data for users and posts.

Run tests

The tests in this project are managed with Pytest and it's integration with Django. Run pytest to run all tests.

Observations

For this implementation of the proposed challenge:

  • The Post model is fully integrated with the User model.
  • 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 GET method.

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.

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages