Created
November 14, 2019 07:30
-
-
Save kalda341/e1aa04683f7471fde3fc1ef9c7ae2696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from psycopg2 import connect | |
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT | |
if __name__ == "__main__": | |
con = connect( | |
host=os.environ["DJANGO_DB_HOST"], | |
port=os.environ["DJANGO_DB_PORT"], | |
user=os.environ["DJANGO_DB_USER"], | |
password=os.environ["DJANGO_DB_PASSWORD"], | |
dbname=None, | |
) | |
con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) | |
cur = con.cursor() | |
cur.execute("CREATE DATABASE " + DB["NAME"]) | |
cur.close() | |
con.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment