Anuj-Panthri commited on
Commit
776aa28
·
1 Parent(s): 05c6af1

changed port

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. README.md +1 -1
  3. test_pg.py +23 -0
Dockerfile CHANGED
@@ -15,4 +15,4 @@ RUN initdb -D /custom_pgdata
15
 
16
  EXPOSE 5432
17
 
18
- CMD ["postgres"]
 
15
 
16
  EXPOSE 5432
17
 
18
+ CMD ["postgres", "-h", "0.0.0.0", "-p", "8080"]
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: gray
5
  colorTo: gray
6
  sdk: docker
7
  pinned: false
8
- app_port: 5432
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
5
  colorTo: gray
6
  sdk: docker
7
  pinned: false
8
+ app_port: 8080
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
test_pg.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import dotenv
3
+ import psycopg2
4
+
5
+ dotenv.load_dotenv()
6
+
7
+ conn = psycopg2.connect(
8
+ host="anuj-panthri-mlops-postgres.hf.space",
9
+ port=8080,
10
+ user=os.environ["POSTGRES_USER"],
11
+ password=os.environ["POSTGRES_PASSWORD"],
12
+ database=os.environ["POSTGRES_DB"],
13
+ connect_timeout=5,
14
+ )
15
+ conn.autocommit = True
16
+
17
+ curr = conn.cursor()
18
+
19
+ curr.execute("""
20
+ CREATE TABLE friend(
21
+ name char
22
+ );
23
+ """)