website online working

This commit is contained in:
2025-08-16 21:51:55 -04:00
parent b70ea0b6a0
commit 8c936793f5
7 changed files with 75 additions and 23 deletions

19
Dockerfile.local Normal file
View 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

View File

@@ -5,13 +5,17 @@ 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':
from settings_local import ApplicationConfig
elif mode == 'LOCAL':
from settings_dev import ApplicationConfig
return ApplicationConfig
elif mode == 'DEVELOPMENT':
from settings_dev import ApplicationConfig
return ApplicationConfig
else:
pass

16
main.py
View File

@@ -12,23 +12,9 @@ app = FastAPI()
app.include_router(delivery.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",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origins=ApplicationConfig.origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],

29
settings_dev.py Normal file
View File

@@ -0,0 +1,29 @@
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",
]

View File

@@ -10,10 +10,19 @@ 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",
]

View File

@@ -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",
]