Mbonea commited on
Commit
3e44c55
·
1 Parent(s): 3c7058e

allow some origins

Browse files
Files changed (1) hide show
  1. App/app.py +10 -2
App/app.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from tortoise import Tortoise
4
  from .Users.UserRoutes import user_router
@@ -10,13 +10,21 @@ from .Plans.PlanRoutes import plan_router
10
  from .Portals.PortalRoutes import portal_router
11
  from .Metrics.MetricsRoutes import metrics_router
12
  from .Messages.MessagesRoute import message_router
 
 
 
 
 
13
 
14
  app = FastAPI()
15
 
16
  # Configure CORS to allow all origins
17
  app.add_middleware(
18
  CORSMiddleware,
19
- allow_origins=["*"], # Allows all origins
 
 
 
20
  allow_credentials=True, # Allows cookies and authentication headers
21
  allow_methods=["*"], # Allows all HTTP methods (GET, POST, PUT, DELETE, etc.)
22
  allow_headers=["*"], # Allows all headers
 
1
+ from fastapi import FastAPI, BackgroundTasks
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from tortoise import Tortoise
4
  from .Users.UserRoutes import user_router
 
10
  from .Portals.PortalRoutes import portal_router
11
  from .Metrics.MetricsRoutes import metrics_router
12
  from .Messages.MessagesRoute import message_router
13
+ from .Subscriptions.background_tasks import check_expiring_subscriptions
14
+ import asyncio
15
+ import logging
16
+
17
+ logging.basicConfig(level=logging.INFO)
18
 
19
  app = FastAPI()
20
 
21
  # Configure CORS to allow all origins
22
  app.add_middleware(
23
  CORSMiddleware,
24
+ allow_origins=[
25
+ "http://localhost:3000", # Localhost for development
26
+ "https://captive-hotspot.vercel.app", # Your production domain
27
+ ], # Allows all origins
28
  allow_credentials=True, # Allows cookies and authentication headers
29
  allow_methods=["*"], # Allows all HTTP methods (GET, POST, PUT, DELETE, etc.)
30
  allow_headers=["*"], # Allows all headers