Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django CRUD PostgreSQL

Testing of django's create, read, updated, and delete using html templates with postgresql.

Preview

Preview

Setup

  1. Clone this repository by running git clone https://github.com/khianvictorycalderon/django-crud-postgresql.git
  2. Generate a safe key using this command in your python interpreter or cmd:
    from django.core.management.utils import get_random_secret_key
    print(get_random_secret_key())
  3. Create an .env file that contains (paste the generated key in DJANGO_SECRET_KEY):
    DJANGO_ENV=development
    DJANGO_SECRET_KEY=your-django-secret-key
    DEBUG=True
    ALLOWED_HOSTS=127.0.0.1, localhost
    DB_NAME=your-db-name
    DB_USER=your-postgresql-user-name
    DB_PASSWORD=your-db-password
    DB_HOST=your-db-host-usually-localhost
    DB_PORT=your-db-port
    Change the allowed credentials depending on where you want your project to be tested.
  4. Run the following command for database migration:
    • python manage.py makemigrations or py manage.py makemigrations
    • python manage.py migrate or py manage.py migrate
  5. To run the server, run py manage.py runserver or python manage.py runserver
    py manage.py runserver 7000
    python manage.py runserver 7000
    Change the 7000 if the port is used already or don't have permission for that port.
  6. To create another app, just run python manage.py startapp <app-name> or py manage.py startapp <app-name>, example: py manage.py startapp myapp

Prerequisites:

Install the following first (globally) if you haven't installed it yet:

  • pip install django psycopg[binary]

About

Useful for django with production db

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages