#Setting up flask server
73 messages · Page 1 of 1 (latest)
If you're looking for instructions on how to set up a Flask server on NixOS, you can find them here. Alternatively, you can use the Heroku buildpacks to install Flask on your NixOS system.
rip
Deleted your other comment. Please keep it in this thread
Apologies but you'll have to wait for someone in the community to help
ok
what does "TERM enviroment variable not set" mean?
gonna need code to help yall
wait can u help out rq
so we're using flask
ok so we're using flask and the logs are showing but when accessing the page it says url not found
^
ok dms
# modules
import os
import json
import time
import logging
import requests
import threading
from flask import Flask, request, session
from flask_cors import CORS
from importlib import import_module
from gevent.pywsgi import WSGIServer
from constants import pages, accounts
from datetime import datetime
from bson import json_util
# constants
app = Flask(__name__)
cors = CORS(app)
app.config["CORS_HEADERS"] = "application/json"
app.config["SECRET_KEY"] = "!!THEDARKESTOFBIOS123123123123123123!!"
app.config["IMAGE_UPLOADS"] = "./static/upload_cache"
app.config["ALLOWED_IMAGE_EXTENSIONS"] = ["PNG", "JPG", "JPEG", "GIF"]
app.config['MAX_CONTENT_LENGTH'] = 25 * 1024 * 1024
routes = ["admin", "api", "errors", "public"]
# clear console
os.system("clear")
@app.before_request
def check_request():
try:
print(
f"Request logged:\n{request.headers.get('X-Forwarded-For')} / {request.headers.get('Cf-Connecting-Ip')} {request.method} | {request.path}\n{request.form}"
)
except:
pass
# load app
http_server = WSGIServer(('0.0.0.0', int(os.environ.get('PORT', 80))), app)
print(int(os.environ.get('PORT', 80)))
http_server.serve_forever()```
our routes are in diff files
If your build logs are successful we don't need them
exactly 💀
if you have a repo can you please send that so we can deploy directly from there?
🤯
no its
oki but i have to inv u to it
im so confused
its a private repo my good sir
@split flicker ive got this one 😭
os.system("clear")
```remove that line
it wont work on railway
and set the PORT var to 8080 on railway
in service settings
http_server = WSGIServer(('0.0.0.0', int(os.environ.get('PORT', 8080))), app)
print(int(os.environ.get('PORT', 8080)))
```then change it to 8080 here as well
wdym by it "didnt work"
yea 😦
gonna need to see ur repo structure
oki whats ur github!
ss vscode or something
screenshare?
ok invited
oh ok, whats the best way to go about doing this