{"id":22135838,"url":"https://github.com/imvickykumar999/postgresql","last_synced_at":"2026-04-28T21:34:25.735Z","repository":{"id":204236373,"uuid":"711390231","full_name":"imvickykumar999/PostgreSQL","owner":"imvickykumar999","description":"How to Use PostgreSQL in Python","archived":false,"fork":false,"pushed_at":"2025-01-16T07:34:39.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-13T01:31:59.431Z","etag":null,"topics":["database","postgresql","tutorial"],"latest_commit_sha":null,"homepage":"https://www.freecodecamp.org/news/postgresql-in-python/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imvickykumar999.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-29T05:29:04.000Z","updated_at":"2025-01-16T07:34:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"c60151e3-26ba-4b47-8efe-6d472982c398","html_url":"https://github.com/imvickykumar999/PostgreSQL","commit_stats":null,"previous_names":["imvickykumar999/postgresql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imvickykumar999/PostgreSQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imvickykumar999%2FPostgreSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imvickykumar999%2FPostgreSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imvickykumar999%2FPostgreSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imvickykumar999%2FPostgreSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imvickykumar999","download_url":"https://codeload.github.com/imvickykumar999/PostgreSQL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imvickykumar999%2FPostgreSQL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32400866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","postgresql","tutorial"],"created_at":"2024-12-01T19:17:43.493Z","updated_at":"2026-04-28T21:34:25.720Z","avatar_url":"https://github.com/imvickykumar999.png","language":"Python","readme":"To use PostgreSQL as the database in your Django project instead of the default SQLite, follow these steps:\n\n---\n\n### **1. Install the PostgreSQL Driver**\nInstall the `psycopg2` library, which allows Django to connect to PostgreSQL:\n```bash\npip install psycopg2-binary\n```\n\n---\n\n### **2. Update the `DATABASES` Configuration in `settings.py`**\nOpen your Django project's `settings.py` file and modify the `DATABASES` configuration as follows:\n\n```python\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql',\n        'NAME': 'your_database_name',  # Replace with your PostgreSQL database name\n        'USER': 'your_postgres_username',  # Replace with your PostgreSQL username\n        'PASSWORD': 'your_postgres_password',  # Replace with your PostgreSQL password\n        'HOST': '127.0.0.1',  # Use 'localhost' or your database server's IP\n        'PORT': '5432',  # Default PostgreSQL port\n    }\n}\n```\n\n---\n\n### **3. Create the PostgreSQL Database**\nBefore running your Django project, ensure the PostgreSQL database is created:\n1. Open the `psql` shell:\n   ```bash\n   psql -U postgres\n   ```\n2. Create the database:\n   ```sql\n   CREATE DATABASE your_database_name;\n   ```\n3. Grant privileges to your user:\n   ```sql\n   GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_postgres_username;\n   ```\n\n---\n\n### **4. Apply Migrations**\nRun Django migrations to set up the database schema in PostgreSQL:\n```bash\npython manage.py makemigrations\npython manage.py migrate\n```\n\n---\n\n### **5. Test the Configuration**\nRun the Django development server to ensure everything is working:\n```bash\npython manage.py runserver\n```\n\nIf everything is configured correctly, Django will now use PostgreSQL instead of SQLite.\n\n---\n\n### **6. Optional: Install pgAdmin (GUI Tool)**\nIf you prefer a GUI to manage your PostgreSQL database, you can install pgAdmin:\n- Download from [pgAdmin's official website](https://www.pgadmin.org/).\n- Use it to manage your PostgreSQL database visually.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimvickykumar999%2Fpostgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimvickykumar999%2Fpostgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimvickykumar999%2Fpostgresql/lists"}