#index.py
from routes.frontend import index
from models import setDBconnection
app = index.app
import socket
host = socket.getfqdn()
addr = socket.gethostbyname(host)
if(addr == '127.0.1.1'):
app.run(host='localhost', port=7000, debug=True, reloader=True)
#routes/frontend/index.py
import config
#pip install bottle
from bottle import Bottle
app = Bottle()
@app.route('/')
def index():
return config.kdict['siteTitle']
#config.py
import os
#pip install python-dotenv
from dotenv import load_dotenv
load_dotenv()
kdict = {}
kdict['SECRET_KEY'] = os.environ.get('SECRET_KEY')
kdict['siteTitle'] = 'Khmer Web Vlog'
kdict['pageTitle'] = 'ទំព័រដ់ើម'
kdict['message'] = ''
kdict['maxPosts'] = 10
#models/setConnection.py
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
from bottle import request
cred = credentials.Certificate('credential.json')
firebase_admin.initialize_app(cred)
db = firestore.client()
request.mydb = db
Vercel: https://khmerweb-vlog.vercel.app