website online working
This commit is contained in:
@@ -12,12 +12,6 @@ COPY requirements.txt /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip3 install setuptools
|
||||
|
||||
RUN pip3 install fastapi
|
||||
|
||||
RUN pip3 install sqlalchemy
|
||||
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 8000
|
||||
19
Dockerfile.local
Normal file
19
Dockerfile.local
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM python:3.12-bullseye
|
||||
|
||||
ENV PYTHONFAULTHANDLER=1
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
ENV MODE="LOCAL"
|
||||
|
||||
RUN mkdir -p /app
|
||||
|
||||
COPY requirements.txt /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
COPY . /app
|
||||
@@ -1,7 +1,5 @@
|
||||
FROM python:3.12-bullseye
|
||||
|
||||
ENV TZ="America/New_York"
|
||||
|
||||
ENV PYTHONFAULTHANDLER=1
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
@@ -14,10 +12,8 @@ COPY requirements.txt /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip3 install setuptools
|
||||
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 8001
|
||||
EXPOSE 8000
|
||||
|
||||
COPY . /app
|
||||
@@ -9,7 +9,6 @@ from database import Base
|
||||
|
||||
class Card_Card(Base):
|
||||
__tablename__ = 'card_card'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer,
|
||||
|
||||
@@ -7,7 +7,6 @@ from database import Base
|
||||
|
||||
class Employee_Employee(Base):
|
||||
__tablename__ = 'employee_employee'
|
||||
__bind_key__ = 'eamco'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(INTEGER,
|
||||
|
||||
@@ -5,13 +5,16 @@ def load_config(mode=os.environ.get('MODE')):
|
||||
try:
|
||||
print(f"mode is {mode}")
|
||||
if mode == 'PRODUCTION':
|
||||
|
||||
from settings_prod import ApplicationConfig
|
||||
return ApplicationConfig
|
||||
elif mode == 'DEVELOPMENT':
|
||||
|
||||
elif mode == 'LOCAL':
|
||||
from settings_local import ApplicationConfig
|
||||
return ApplicationConfig
|
||||
|
||||
elif mode == 'DEVELOPMENT':
|
||||
from settings_dev import ApplicationConfig
|
||||
return ApplicationConfig
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
21
main.py
21
main.py
@@ -1,6 +1,11 @@
|
||||
from fastapi import FastAPI
|
||||
from app.routers import main, delivery, confirm
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import os
|
||||
from config import load_config
|
||||
|
||||
|
||||
ApplicationConfig = load_config()
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
@@ -10,23 +15,11 @@ app.include_router(main.router)
|
||||
app.include_router(delivery.router)
|
||||
app.include_router(confirm.router)
|
||||
|
||||
origins = [
|
||||
"http://localhost:9000",
|
||||
"https://localhost:9513",
|
||||
"http://localhost:9514",
|
||||
"http://localhost:9512",
|
||||
"http://localhost:9511",
|
||||
"http://192.168.1.204:9000",
|
||||
"http://192.168.1.204:9513",
|
||||
"http://192.168.1.204:9514",
|
||||
"http://192.168.1.204:9512",
|
||||
"http://192.168.1.204:9511",
|
||||
]
|
||||
|
||||
|
||||
# print(ApplicationConfig.origins)
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_origins=ApplicationConfig.origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
||||
@@ -2,4 +2,5 @@ fastapi
|
||||
uvicorn[standard]
|
||||
psycopg2-binary
|
||||
sqlalchemy
|
||||
pyowm
|
||||
pyowm
|
||||
setuptools
|
||||
28
settings_dev.py
Normal file
28
settings_dev.py
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
class ApplicationConfig:
|
||||
"""
|
||||
Basic Configuration for a generic User
|
||||
"""
|
||||
CURRENT_SETTINGS = 'DEVELOPMENT'
|
||||
# databases info
|
||||
POSTGRES_USERNAME = 'postgres'
|
||||
POSTGRES_PW = 'password'
|
||||
POSTGRES_SERVER = '192.168.1.204'
|
||||
POSTGRES_PORT = '5432'
|
||||
POSTGRES_DBNAME00 = 'eamco'
|
||||
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://{}:{}@{}/{}".format(POSTGRES_USERNAME,
|
||||
POSTGRES_PW,
|
||||
POSTGRES_SERVER,
|
||||
POSTGRES_DBNAME00
|
||||
)
|
||||
SQLALCHEMY_BINDS = {'eamco': SQLALCHEMY_DATABASE_URI}
|
||||
|
||||
origins = [
|
||||
"http://localhost:9000",
|
||||
"https://localhost:9513",
|
||||
"http://localhost:9514",
|
||||
"http://localhost:9512",
|
||||
"http://localhost:9511",
|
||||
|
||||
]
|
||||
@@ -10,10 +10,20 @@ class ApplicationConfig:
|
||||
POSTGRES_PW = 'password'
|
||||
POSTGRES_SERVER = '192.168.1.204'
|
||||
POSTGRES_PORT = '5432'
|
||||
POSTGRES_DBNAME00 = 'eamco'
|
||||
POSTGRES_DBNAME00 = 'auburnoil'
|
||||
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://{}:{}@{}/{}".format(POSTGRES_USERNAME,
|
||||
POSTGRES_PW,
|
||||
POSTGRES_SERVER,
|
||||
POSTGRES_DBNAME00
|
||||
)
|
||||
|
||||
SQLALCHEMY_BINDS = {'auburnoil': SQLALCHEMY_DATABASE_URI}
|
||||
|
||||
|
||||
origins = [
|
||||
"http://192.168.1.204:9000",
|
||||
"http://192.168.1.204:9613",
|
||||
"http://192.168.1.204:9614",
|
||||
"http://192.168.1.204:9612",
|
||||
"http://192.168.1.204:9611",
|
||||
]
|
||||
@@ -2,7 +2,7 @@ class ApplicationConfig:
|
||||
"""
|
||||
Basic Configuration for a generic User
|
||||
"""
|
||||
CURRENT_SETTINGS = 'LOCAL'
|
||||
CURRENT_SETTINGS = 'PRODUCTION'
|
||||
# databases info
|
||||
POSTGRES_USERNAME = 'postgres'
|
||||
POSTGRES_PW = 'password'
|
||||
@@ -14,4 +14,9 @@ class ApplicationConfig:
|
||||
POSTGRES_SERVER,
|
||||
POSTGRES_DBNAME00
|
||||
)
|
||||
SQLALCHEMY_BINDS = {'eamco': SQLALCHEMY_DATABASE_URI}
|
||||
SQLALCHEMY_BINDS = {'auburnoil': SQLALCHEMY_DATABASE_URI}
|
||||
|
||||
origins = [
|
||||
"https://oil.edwineames.com",
|
||||
"https://apiauto.edwineames.com",
|
||||
]
|
||||
Reference in New Issue
Block a user