https://github.com/mrlonis/python-open-restaurant-django
About Demo API, written in Python Django, with one route that takes a datetime string and returns a list of open restaurants, if any.
https://github.com/mrlonis/python-open-restaurant-django
django djangorestframework postgresql python
Last synced: 3 months ago
JSON representation
About Demo API, written in Python Django, with one route that takes a datetime string and returns a list of open restaurants, if any.
- Host: GitHub
- URL: https://github.com/mrlonis/python-open-restaurant-django
- Owner: mrlonis
- License: mit
- Created: 2023-03-10T02:42:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-16T22:59:22.000Z (6 months ago)
- Last Synced: 2025-12-19T04:19:40.560Z (6 months ago)
- Topics: django, djangorestframework, postgresql, python
- Language: Python
- Homepage:
- Size: 501 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-open-restaurant-django
Demo API using Django with one route that takes a datetime string and returns open restaurants, if any.
The Django project was initialized using the command:
```sh
django-admin startproject project .
```
The api application was created using the command:
```sh
python manage.py startapp api
```
## Table of Contents
- [python-open-restaurant-django](#python-open-restaurant-django)
- [Table of Contents](#table-of-contents)
- [Pre-requisites](#pre-requisites)
- [.env File](#env-file)
- [Required Build Packages](#required-build-packages)
- [Docker](#docker)
- [Migrate the Database](#migrate-the-database)
- [Linting](#linting)
- [Testing](#testing)
## Pre-requisites
### .env File
Create a .env file in the root directory of your project based off of the `.env.sample` file.
### Required Build Packages
```shell
sudo apt-get install gcc libpq-dev python3-dev
```
### Docker
Install Docker and run the following command to startup the database/api in Docker:
```sh
docker compose up --build --pull postgresql --remove-orphans -V --wait
```
## Migrate the Database
```shell
poetry run python manage.py migrate
```
## Linting
To lint the project, run the following commands:
```shell
poetry run flake8 api project manage.py
poetry run pylint api project manage.py
```
## Testing
To run the tests, be sure you have ran the [Docker Compose Command](#docker), then run the following command:
```sh
poetry run python manage.py test
```