Skip to content

Recipes Django API is a simple app developed in Python using the Django REST Framework. This is a learning application focused on studying this incredible framework with the purpose of increasing an existing skill and apply everything I've learn about Python and Django using TDD and following PEP8 guideline.

License

Notifications You must be signed in to change notification settings

isc-hemc/recipes-django-api

Repository files navigation

Recipes Django API

Recipes Django API is a simple app developed in Python using the Django REST Framework. This is a learning application focused on studying this incredible framework with the purpose of increasing an existing skill and apply everything I've learn about Python and Django using TDD and following PEP8 guideline.

Contents

Dependencies

Docker 20.10.2 Python 3.8 Django 2.2.0 Django REST Framework 3.10.0 MySQL 8.0

Content

Installing Dependencies

This project uses pipenv to create a virtual environment and manage the project dependencies.

Use the following command to install the project dependencies and create the virtual environment.

pipenv install

Use the following command to install de development dependencies.

pipenv install --dev

Use the following command to check the path of the virtual environment.

pipenv --venv

Executing Migrations

In the .vscode folder there is a launch file so in the VSCode Debugger we can easily execute the API: Make Migrations and the API: Migrate tasks in that order. To execute the migrations manually you can use the following commands:

pipenv run python manage.py makemigrations
pipenv run python manage.py migrate

Appendices

Database

The Docker configuration for the MySQL service is located in the db folder, once you install the project dependencies, the prompt may trigger an error coming from the mysqlclient package, make shure to make the proper configuration as the mysqlclient docs point out, for example, for MacOS before runing pipenv install, run:

brew install mysql

Pre Commit

The pre-commit configuration can be found in .pre-commit-config.yaml file. When cloning this repository you should execute the following command in order to set up the git hook scripts:

pipenv run pre-commit install

Now, pre-commit will run automatically on git commit.

Git Flow

This project uses git-flow guideline to perform high-level repository operations. Once you clone this repository make shure to execute the following command to start using git-flow and continue using the project guideline.

git flow init

For this project from the main branch we will take the production build and from the develop branch the staging environment.

Feature

For developing a new feature we need to run the following command:

git flow feature start my-feature

Once all the changes are done we should squash all out commits and merge with the developbranch:

git flow feature finish my-feature

Release

For release a new version of the application we should run the following command:

git flow release start vX.X.X

The vX.X.X will be the version tag of the release, we use semver guideline when creating a new release version. Once the release it ready to be deployed we can run the following command:

git flow release finish vX.X.X

This will merge the release branch into develop and main, but not only that, it will also create a tag that we will push to our repository using the command:

git push --tags

This will help us to keep out project stable and healthy.

Django Utils

Creating a Project

This project uses pipenv to manage the project dependencies and environment, after installing the Django dependency (pipenv install Django~=2.2.0), we can easily create a Django project executing the following command:

pipenv run django-admin startproject app .

Creating an Application

As we are creating all our applications inside the app folder we can create a new app using the following commands:

cd app
pipenv run python ./../manage.py startapp core

Creating a Superuser

After launching the project we can easily create a superuser executing the following command:

pipenv run python manage.py createsuperuser

After that, enter the email and password of the superuser in the command line.

About

Recipes Django API is a simple app developed in Python using the Django REST Framework. This is a learning application focused on studying this incredible framework with the purpose of increasing an existing skill and apply everything I've learn about Python and Django using TDD and following PEP8 guideline.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published