website online working
This commit is contained in:
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
|
||||||
12
config.py
12
config.py
@@ -5,13 +5,17 @@ def load_config(mode=os.environ.get('MODE')):
|
|||||||
try:
|
try:
|
||||||
print(f"mode is {mode}")
|
print(f"mode is {mode}")
|
||||||
if mode == 'PRODUCTION':
|
if mode == 'PRODUCTION':
|
||||||
|
|
||||||
from settings_prod import ApplicationConfig
|
from settings_prod import ApplicationConfig
|
||||||
return ApplicationConfig
|
return ApplicationConfig
|
||||||
elif mode == 'DEVELOPMENT':
|
|
||||||
|
elif mode == 'LOCAL':
|
||||||
from settings_local import ApplicationConfig
|
from settings_dev import ApplicationConfig
|
||||||
return ApplicationConfig
|
return ApplicationConfig
|
||||||
|
|
||||||
|
elif mode == 'DEVELOPMENT':
|
||||||
|
from settings_dev import ApplicationConfig
|
||||||
|
return ApplicationConfig
|
||||||
|
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
16
main.py
16
main.py
@@ -12,23 +12,9 @@ app = FastAPI()
|
|||||||
app.include_router(delivery.router)
|
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(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=origins,
|
allow_origins=ApplicationConfig.origins,
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
29
settings_dev.py
Normal file
29
settings_dev.py
Normal 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",
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
@@ -10,10 +10,19 @@ class ApplicationConfig:
|
|||||||
POSTGRES_PW = 'password'
|
POSTGRES_PW = 'password'
|
||||||
POSTGRES_SERVER = '192.168.1.204'
|
POSTGRES_SERVER = '192.168.1.204'
|
||||||
POSTGRES_PORT = '5432'
|
POSTGRES_PORT = '5432'
|
||||||
POSTGRES_DBNAME00 = 'eamco'
|
POSTGRES_DBNAME00 = 'auburnoil'
|
||||||
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://{}:{}@{}/{}".format(POSTGRES_USERNAME,
|
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://{}:{}@{}/{}".format(POSTGRES_USERNAME,
|
||||||
POSTGRES_PW,
|
POSTGRES_PW,
|
||||||
POSTGRES_SERVER,
|
POSTGRES_SERVER,
|
||||||
POSTGRES_DBNAME00
|
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
|
Basic Configuration for a generic User
|
||||||
"""
|
"""
|
||||||
CURRENT_SETTINGS = 'LOCAL'
|
CURRENT_SETTINGS = 'PRODUCTION'
|
||||||
# databases info
|
# databases info
|
||||||
POSTGRES_USERNAME = 'postgres'
|
POSTGRES_USERNAME = 'postgres'
|
||||||
POSTGRES_PW = 'password'
|
POSTGRES_PW = 'password'
|
||||||
@@ -14,4 +14,9 @@ class ApplicationConfig:
|
|||||||
POSTGRES_SERVER,
|
POSTGRES_SERVER,
|
||||||
POSTGRES_DBNAME00
|
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