Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add static_router.py #76

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from flask import Flask
from router.pixiv_router import pixiv_router, router_set_pixiv_api
from router.static_router import static_router
from services.pixiv import Pixiv


Expand All @@ -15,6 +16,7 @@ def init(self, config):
self.myPixiv = Pixiv(service_name="pixiv", username=self.username, password=self.password,
interval=3500)
self.register_blueprint(pixiv_router)
self.register_blueprint(static_router)
self.pass_context()

def run_services(self) -> (bool, str):
Expand Down
13 changes: 0 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
from app.config import Config
from app.app import App
from flask import send_from_directory

app = App(__name__)


# Only to see if this server is running correctly
@app.route('/')
def lsp():
return 'Hello World! lsp!'


@app.route('/Illusts/<path:path>')
def send_illusts(path):
return send_from_directory('Illusts', path)


if __name__ == '__main__':
config_loader = Config()
config_loader.load_dotenv()
Expand Down
14 changes: 14 additions & 0 deletions router/static_router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from flask import Blueprint, send_from_directory

static_router = Blueprint('static_router', __name__)


# Only to see if this server is running correctly
@static_router.route('/')
def lsp():
return 'Hello World! lsp!'


@static_router.route('/Illusts/<path:path>')
def send_illusts(path):
return send_from_directory('Illusts', path)
Loading