Skip to content

Django template with React and Postgres, including Dockerfile and docker-compose.yml

Notifications You must be signed in to change notification settings

grbeno/django-react-starter

Repository files navigation

Django Web Applaction using ReactJS as the frontend (Template)


Prerequisites: Python Node Postgres

💡 Backend: Django

  • ✅ Custom user model

💡 Frontend: ReactJS served as static files

  • ✅ Vite

💡 Database: PostgreSQL

  • psycopg2-binary
  • dj-database-url

❗ If you don't want to use the Docker image for running the application, then you have to install PostgreSQL on your device and create a database before setting up the DATABASE_URL variable.

💡 Environment Variables:

  • SECRET_KEY=<add yours>
  • DATABASE_URL=postgresql://postgres:<password>@localhost:5432/<db_name>* if local database is created
  • SSL_REQUIRE=False

📌 Starting development

  • Creating and activating virtual environment (venv, pipenv e.g.)

  • Installing dependencies: pip install -r requirements.txt

  • Setting up the database if needed, as mentioned above

  • Creating .env file and adding the variables listed above

  • Migrating the data in the case of Docker:

    docker compose run --rm app python manage.py makemigrations accounts
    
    docker compose run --rm app python manage.py migrate
    
  • Migrating the data in the case of local Postgres database:

    python manage.py makemigrations accounts
    
    python manage.py migrate
    
  • Run with Docker:

    docker build -t app .
    
    docker-compose build
    
    docker-compose up
    

On the web browser: localhost:8000 / 127.0.0.1:8000

About

Django template with React and Postgres, including Dockerfile and docker-compose.yml

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published