diff --git a/.gitignore b/.gitignore index 2eea525..e2aaf69 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.env \ No newline at end of file +.env +local_settings.py diff --git a/local_settings.py.example b/local_settings.py.example new file mode 100644 index 0000000..67a5c4f --- /dev/null +++ b/local_settings.py.example @@ -0,0 +1,2 @@ +APPLICATION_PASSWORD = "super-secure-password" +MONGO_URI = "mongodb://127.0.0.1" \ No newline at end of file diff --git a/server.py b/server.py index 652c740..d9a1e6b 100644 --- a/server.py +++ b/server.py @@ -1,15 +1,16 @@ from flask import Flask, request, jsonify from pymongo import MongoClient -from dotenv import load_dotenv -import os - -load_dotenv() app = Flask(__name__) -EXPECTED_PASSWORD = "secret_password" +try: + from local_settings import * +except ImportError: + print("Can't import from localsettings, terminating") + exit() -uri = os.getenv("MONGO_URI") +EXPECTED_PASSWORD = APPLICATION_PASSWORD +uri = MONGO_URI mongo_client = MongoClient(uri) db = mongo_client["user_interactions"] @@ -49,6 +50,3 @@ def submit_event(): resp = jsonify({"error": str(e)}) resp.headers['Access-Control-Allow-Origin'] = '*' return resp, 500 - -if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0', port=5000) \ No newline at end of file