Skip to content

Commit

Permalink
Merge pull request #40 from davidtheplatform/main
Browse files Browse the repository at this point in the history
Add more options to .env
  • Loading branch information
redstone-dev authored Aug 1, 2023
2 parents cd34caf + ce7f051 commit 9972001
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
15 changes: 14 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,21 @@ DAZZLE_DIR=".dazzle-archive"

# change SERVER_MODE to "yes" if running a public server
SERVER_MODE="no"

# Running in Replit?
REPLIT_MODE="no"


USE_SCRATCHDB="yes"

# change this to the IP:PORT that you're going to expose
SERVER_HOST=""
SERVER_HOST="localhost:3000"

# Debug mode
DEBUG="yes"

# Run flask in debug mode
FLASK_DEBUG="yes"

# change USE_SUPABASE to "yes" if SUPABASE_KEY is set
USE_SUPABASE="no"
Expand Down
17 changes: 11 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from flask import Flask, render_template, stream_template, request, redirect
from os import listdir
from os.path import exists
from werkzeug import exceptions as werkexcept
import dazzle
import json

REPLIT_MODE = False
USE_SCRATCHDB = True
HOST, PORT = "localhost", 3000
debug = True

REPLIT_MODE = True if dazzle.env["REPLIT_MODE"] == "yes" else False
USE_SCRATCHDB = True if dazzle.env["USE_SCRATCHDB"] == "yes" else False
HOST, PORT = dazzle.env["SERVER_HOST"].split(":")
DEBUG = True if dazzle.env["DEBUG"] == "yes" else False
FLASK_DEBUG = True if dazzle.env["FLASK_DEBUG"] == "yes" else False

"""
**** Snazzle Server Code ****
Expand Down Expand Up @@ -283,7 +287,7 @@ def project(project_id):
else:
creator_name = str(creator_name) + " ●" # add the dot
ocular_colour = f"color:{ocular_colour}"
if not debug:
if not DEBUG:
return stream_template(
"projects.html",
project_id=project_id,
Expand Down Expand Up @@ -366,4 +370,5 @@ def err404(e: Exception):
return render_template("_error.html", errdata=e), 404

# CHANGE THIS IF YOU'RE RUNNING A PUBLIC SERVER
app.run(host="localhost", port=3000, debug=True)
if __name__ == "__main__":
app.run(host=HOST, port=PORT, debug=FLASK_DEBUG)

0 comments on commit 9972001

Please sign in to comment.