Commit 927cf450 authored by shadMod's avatar shadMod 💬

rm src_directory and replaced with UITWWW_DIR

quick code cleanup
parent 66623a20
......@@ -15,13 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import click
import subprocess
import uitwww
from uitwww import utils
from .constants import UITWWW_DIR, BASE_DIR
from .utils import ReverseProxied, GunicornInstance
from scss.compiler import compile_file
@click.group()
......@@ -40,11 +40,8 @@ def cli():
@click.option("-d", "--debug", help="Enable debug mode", is_flag=True)
def run(data, gunicorn_config, port, public, workers, debug):
"""Run the application"""
# Create the application instance
src_directory = os.path.dirname(os.path.abspath(__file__))
app = uitwww.create_app(data)
app.wsgi_app = utils.ReverseProxied(app.wsgi_app)
app.wsgi_app = ReverseProxied(app.wsgi_app)
host = "127.0.0.1"
if public:
......@@ -53,22 +50,22 @@ def run(data, gunicorn_config, port, public, workers, debug):
# In debug mode, run the flask builtin webserver
if debug:
extra_files = [
os.path.join(src_directory, "data/navbar.yml"),
os.path.join(src_directory, "data/permissions.yml"),
os.path.join(src_directory, "data/redirects.yml"),
os.path.join(src_directory, "data/downloads.toml"),
os.path.join(UITWWW_DIR, "data/navbar.yml"),
os.path.join(UITWWW_DIR, "data/permissions.yml"),
os.path.join(UITWWW_DIR, "data/redirects.yml"),
os.path.join(UITWWW_DIR, "data/downloads.toml"),
]
app.run(debug=True, port=port, host=host, extra_files=extra_files)
# Else run the application with gunicorn
else:
options = {
"bind": host+":"+str(port),
"bind": host + ":" + str(port),
"workers": workers,
"accesslog": "-",
"errorlog": "-",
}
server = utils.GunicornInstance(gunicorn_config, options)
server = GunicornInstance(gunicorn_config, options)
server.app = app
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment