/django-rest-starting

🌴 Starting a new project? API template with: token authentication, pagination, custom user, login and register endpoints, and PostgreSQL

Primary LanguagePython

Initialization

Create a virtual environment

python3 -m venv venv-api
source venv-api/bin/activate

Install requirements.txt

pip install -r requirements.txt

Create superuser

python manage.py createsuperuser

Add sqlite db

db.sqlite3

Add PostgreSQL db (uncomment the code in settings.py)

Then, create an .env file and add the following to connect your local database

LOCAL_DB_NAME=db-name
LOCAL_DB_USER=
LOCAL_DB_PASSWORD=
LOCAL_DB_HOST=127.0.0.1
LOCAL_DB_PORT=5432

Migrate models

python manage.py makemigrations
python manage.py migrate

Run

python manage.py runserver