Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
4d70476e
Commit
4d70476e
authored
Oct 09, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rm src_directory and replaced with UITWWW_DIR
quick code cleanup
parent
50003c7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
uitwww/main.py
uitwww/main.py
+12
-15
No files found.
uitwww/main.py
View file @
4d70476e
...
...
@@ -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
()
...
...
@@ -33,18 +33,15 @@ def cli():
@
cli
.
command
(
"run"
)
@
click
.
argument
(
"data"
)
@
click
.
option
(
"-g"
,
"--gunicorn-config"
,
default
=
None
,
help
=
"Path to a"
"gunicorn config file"
)
"gunicorn config file"
)
@
click
.
option
(
"-p"
,
"--port"
,
default
=
8000
,
help
=
"Bind that port"
)
@
click
.
option
(
"--public"
,
help
=
"Make available to the public"
,
is_flag
=
True
)
@
click
.
option
(
"-w"
,
"--workers"
,
help
=
"Number of workers to start"
,
default
=
3
)
@
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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment