add readme
This commit is contained in:
parent
2dd3a34f5b
commit
86d8ea3ad2
117
README.md
Normal file
117
README.md
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
# Django Docker Quickstart
|
||||||
|
|
||||||
|
This is a quickstart for Django with Docker.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Django
|
||||||
|
- PostgreSQL
|
||||||
|
- Redis
|
||||||
|
- Celery(worker and beat)
|
||||||
|
- Nginx
|
||||||
|
- Traefik
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
- Docker Compose
|
||||||
|
- Python 3.10 or higher
|
||||||
|
- Make(optional for shortcuts)
|
||||||
|
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
To get started, follow these steps:
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/godd0t/django-docker-quickstart.git
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Change directory into the project:
|
||||||
|
```
|
||||||
|
cd django-docker-quickstart
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Copy the `env.example` file to `.env` and update the values as needed:
|
||||||
|
```
|
||||||
|
cp env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
## Initial Setup
|
||||||
|
|
||||||
|
### Development
|
||||||
|
|
||||||
|
To set up the project for development, follow these steps:
|
||||||
|
|
||||||
|
1. Create a virtual environment:
|
||||||
|
```
|
||||||
|
python -m venv venv
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Activate the virtual environment:
|
||||||
|
```
|
||||||
|
source venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install the development requirements:
|
||||||
|
```
|
||||||
|
pip install -r requirements/requirements-dev.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Build and run the project:
|
||||||
|
```
|
||||||
|
docker-compose up --build -d
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Production
|
||||||
|
|
||||||
|
To set up the project for production, follow these steps:
|
||||||
|
|
||||||
|
1. Build the image and run the container:
|
||||||
|
```
|
||||||
|
docker-compose -f docker-compose.prod.yml up --build -d
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Shortcuts
|
||||||
|
|
||||||
|
To make development easier, there are a few shortcuts available:
|
||||||
|
|
||||||
|
Create migrations:
|
||||||
|
|
||||||
|
```
|
||||||
|
make make-migrations
|
||||||
|
```
|
||||||
|
|
||||||
|
Run migrations:
|
||||||
|
|
||||||
|
```
|
||||||
|
make migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the linter:
|
||||||
|
|
||||||
|
```
|
||||||
|
make lint
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the formatter:
|
||||||
|
|
||||||
|
```
|
||||||
|
make format
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the tests:
|
||||||
|
|
||||||
|
```
|
||||||
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a super user:
|
||||||
|
|
||||||
|
```
|
||||||
|
make super-user
|
||||||
|
```
|
@ -9,5 +9,5 @@ else
|
|||||||
python manage.py makemigrations --noinput
|
python manage.py makemigrations --noinput
|
||||||
python manage.py migrate --noinput
|
python manage.py migrate --noinput
|
||||||
python manage.py collectstatic --noinput
|
python manage.py collectstatic --noinput
|
||||||
gunicorn "$APP_NAME".wsgi:application --bind "$APP_HOST":"$APP_PORT" --workers 3 --log-level=debug
|
gunicorn "$APP_NAME".wsgi:application --bind "$APP_HOST":"$APP_PORT" --workers 3 --log-level=info
|
||||||
fi
|
fi
|
||||||
|
@ -57,7 +57,7 @@ target-version = ['py311']
|
|||||||
include = '\.pyi?$'
|
include = '\.pyi?$'
|
||||||
# 'extend-exclude' excludes files or directories in addition to the defaults
|
# 'extend-exclude' excludes files or directories in addition to the defaults
|
||||||
extend-exclude = '''
|
extend-exclude = '''
|
||||||
^/migrations/
|
^(.*/)?migrations/.*$
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ extend-exclude = '''
|
|||||||
format = "grouped"
|
format = "grouped"
|
||||||
line-length = 88 # black default
|
line-length = 88 # black default
|
||||||
extend-exclude = [
|
extend-exclude = [
|
||||||
"*/migrations/*",
|
"src/migrations/*",
|
||||||
"src/media/*",
|
"src/media/*",
|
||||||
"src/static/*",
|
"src/static/*",
|
||||||
"src/manage.py",
|
"src/manage.py",
|
||||||
|
4
src/requirements.dev.txt
Normal file
4
src/requirements.dev.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
-r requirements.txt
|
||||||
|
black==23.3.0
|
||||||
|
ruff==0.0.265
|
||||||
|
coverage[toml]==7.2.5
|
Loading…
Reference in New Issue
Block a user