Skip to content

Commit 6eada0c

Browse files
fix conflicts with upstream branch
2 parents ecb84bc + 9972001 commit 6eada0c

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.env

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@ DAZZLE_DIR=".dazzle-archive"
33

44
# change SERVER_MODE to "yes" if running a public server
55
SERVER_MODE="no"
6+
7+
# Running in Replit?
8+
REPLIT_MODE="no"
9+
10+
11+
USE_SCRATCHDB="yes"
12+
613
# change this to the IP:PORT that you're going to expose
7-
SERVER_HOST="http://localhost:5000"
14+
SERVER_HOST="localhost:3000"
15+
16+
# Debug mode
17+
DEBUG="yes"
18+
19+
# Run flask in debug mode
20+
FLASK_DEBUG="yes"
821

922
DB_LOCATION="users.sqlite"
1023
DB_TABLE="users"

app.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from os import listdir
22
from flask import Flask, render_template, stream_template, request, redirect
3+
from os.path import exists
34
from werkzeug import exceptions as werkexcept
45
import dazzle
6+
import json
57

6-
REPLIT_MODE = False
7-
USE_SCRATCHDB = True
88

9-
debug = True
9+
REPLIT_MODE = True if dazzle.env["REPLIT_MODE"] == "yes" else False
10+
USE_SCRATCHDB = True if dazzle.env["USE_SCRATCHDB"] == "yes" else False
11+
HOST, PORT = dazzle.env["SERVER_HOST"].split(":")
12+
DEBUG = True if dazzle.env["DEBUG"] == "yes" else False
13+
FLASK_DEBUG = True if dazzle.env["FLASK_DEBUG"] == "yes" else False
1014

1115
"""
1216
**** Snazzle Server Code ****
@@ -256,7 +260,7 @@ def project(project_id):
256260
else:
257261
creator_name = str(creator_name) + " ●" # add the dot
258262
ocular_colour = f"color:{ocular_colour}"
259-
if not debug:
263+
if not DEBUG:
260264
return stream_template(
261265
"projects.html",
262266
project_id=project_id,
@@ -350,3 +354,7 @@ def scratch_auth():
350354
def err404(e: Exception):
351355
# route for error
352356
return render_template("_error.html", errdata=e), 404
357+
358+
# CHANGE THIS IF YOU'RE RUNNING A PUBLIC SERVER
359+
if __name__ == "__main__":
360+
app.run(host=HOST, port=PORT, debug=FLASK_DEBUG)

0 commit comments

Comments
 (0)