mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Put frontend code in static folder (#324)
* Create webapp module in admin folder for flask app * Almost working, but templates folder is still not included in packaged setup.py install output * Update manifest file * Got flask app working with templates
This commit is contained in:
parent
5292a15884
commit
864db3d04e
9 changed files with 22 additions and 6 deletions
|
|
@ -1 +1,2 @@
|
|||
global-exclude *.pyc
|
||||
include README.md
|
||||
include squeakserver/admin/webapp/templates/*.html
|
||||
|
|
|
|||
0
squeakserver/admin/webapp/__init__.py
Normal file
0
squeakserver/admin/webapp/__init__.py
Normal file
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
from os.path import abspath, dirname
|
||||
import logging
|
||||
|
||||
from flask import Flask
|
||||
|
|
@ -18,8 +19,8 @@ from google.protobuf import message
|
|||
from proto import squeak_admin_pb2, squeak_admin_pb2_grpc
|
||||
from proto import lnd_pb2, lnd_pb2_grpc
|
||||
|
||||
from squeakserver.admin.squeak_admin_web_user import User
|
||||
from squeakserver.admin.forms import LoginForm
|
||||
from squeakserver.admin.webapp.squeak_admin_web_user import User
|
||||
from squeakserver.admin.webapp.forms import LoginForm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -27,11 +28,19 @@ logger = logging.getLogger(__name__)
|
|||
def create_app(handler, username, password):
|
||||
# create and configure the app
|
||||
logger.info("Starting flask app from directory: {}".format(os.getcwd()))
|
||||
root_path = 'squeakserver/admin/webapp'
|
||||
# root_path = os.path.dirname(os.path.realpath(__file__))
|
||||
logger.info("Starting flask with root_path: {}".format(root_path))
|
||||
# readme = open("README.md", "r").read()
|
||||
# logger.info("Starting flask with README: {}".format(readme))
|
||||
# base_template = open("squeakserver/admin/webapp/templates/base.html", "r").read()
|
||||
# logger.info("Starting flask with template: {}".format(base_template))
|
||||
app = Flask(
|
||||
__name__,
|
||||
static_folder='/app/static/build',
|
||||
static_url_path='/',
|
||||
template_folder='/app/squeakserver/admin/templates',
|
||||
template_folder='templates',
|
||||
root_path=root_path,
|
||||
)
|
||||
app.config.from_mapping(
|
||||
SECRET_KEY='dev',
|
||||
|
|
@ -41,6 +50,12 @@ def create_app(handler, username, password):
|
|||
username,
|
||||
password,
|
||||
)
|
||||
logger.info("Starting flask with app.root_path: {}".format(app.root_path))
|
||||
logger.info("Files in root path: {}".format(os.listdir(app.root_path)))
|
||||
other_path = abspath(dirname(__file__))
|
||||
logger.info("Starting flask other_path: {}".format(other_path))
|
||||
logger.info("template folder: {}".format(app.template_folder))
|
||||
# logger.info("Files in template folder: {}".format(os.listdir(app.template_folder)))
|
||||
|
||||
|
||||
@login.user_loader
|
||||
|
|
@ -2,7 +2,7 @@ from flask_wtf import FlaskForm
|
|||
from wtforms import StringField, PasswordField, BooleanField, SubmitField
|
||||
from wtforms.validators import ValidationError, DataRequired, EqualTo
|
||||
|
||||
from squeakserver.admin.squeak_admin_web_user import User
|
||||
from squeakserver.admin.webapp.squeak_admin_web_user import User
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
|
|
@ -10,7 +10,7 @@ from squeak.params import SelectParams
|
|||
|
||||
from squeakserver.admin.squeak_admin_server_handler import SqueakAdminServerHandler
|
||||
from squeakserver.admin.squeak_admin_server_servicer import SqueakAdminServerServicer
|
||||
from squeakserver.admin.squeak_admin_web_service import SqueakAdminWebServer
|
||||
from squeakserver.admin.webapp.app import SqueakAdminWebServer
|
||||
from squeakserver.blockchain.bitcoin_blockchain_client import BitcoinBlockchainClient
|
||||
from squeakserver.common.lnd_lightning_client import LNDLightningClient
|
||||
from squeakserver.db.db_engine import get_postgres_engine, get_sqlite_engine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue