TV 채널 웹사이트: 대시보드로 연결

GitHub: https://github.com/Sokhavuth/TV-Channel
베르셀: https://khmerweb-tv-channel.vercel.app/login

대시보드를 구축하려면 먼저 해당 페이지에 대한 경로를 정의해야 합니다. 이 라우트는 컨트롤러 섹션의 Post 클래스에 연결되고 Views 섹션에 연결됩니다.


# index.py

from bottle import static_file, get
from routes.frontend import index
from routes.frontend import login
from routes.backend import admin


app = index.app
app.mount("/login", login.app)
app.mount("/admin", admin.app)

@app.get('/static/<filepath:path>')
def staticFile(filepath):
    return static_file(filepath, root="public")


###################################################################
import socket
host = socket.getfqdn()    
addr = socket.gethostbyname(host)
if(addr == '127.0.1.1'):
    app.run(host='localhost', port=8000, debug=True, reloader=True)

###################################################################



# routes/backend/admin.py

from bottle import Bottle


app = Bottle()

from . import post
app.mount("/post", post.app)



# routes/backend/post.py

from bottle import Bottle, get
from controllers.backend.post import Post


app = Bottle()
post = Post()

@app.get("/")
def getPage():
    return post.getPage()



# controllers/backend/post.py

import config, copy
from bottle import template, redirect, request

class Post:
    def __init__(self):
        self.setup = copy.deepcopy(config.settings())


    def getPage(self):
        self.setup["pageTitle"] = "Post Page"
        self.setup["route"] = "/admin/post"

        return template("base", data=self.setup)


좋은 웹페이지 즐겨찾기