#Setting up flask server

73 messages · Page 1 of 1 (latest)

lost ploverBOT
#

Project ID: N/A

#

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.

strange bronze
#

M/a

#

N/A

#

f86795d0-b5ee-4692-b8ff-de8f4f28566b

rough thunder
#

rip

rough thunder
#

find them where

edgy crown
# strange bronze M/a

Deleted your other comment. Please keep it in this thread

Apologies but you'll have to wait for someone in the community to help

strange bronze
rough thunder
#

yo it broke

#

fr

#

we need someone smort

icy frost
#

gonna need code to help yall

strange bronze
#

so we're using flask

rough thunder
#

ghes gonna neewd rthe code

#

to help

#

lol

strange bronze
#

ok so we're using flask and the logs are showing but when accessing the page it says url not found

icy frost
strange bronze
icy frost
#

yeah thats probably enough

#

that plus build logs

strange bronze
icy frost
#

no send them here lol

#

there shouldnt be anything private in there anyway

strange bronze
# icy frost no send them here lol
# 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

split flicker
#

If your build logs are successful we don't need them

strange bronze
#

exactly 💀

split flicker
#

if you have a repo can you please send that so we can deploy directly from there?

strange bronze
#

im so confused

rough thunder
strange bronze
#

what do you guys want me to do

#

ill do it

icy frost
#

@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
strange bronze
#

it didnt work

#

but it printed this:

rough thunder
#

its the printed port my guy

#

6526

#

and the tohers are reuqest lofs

icy frost
#

wdym by it "didnt work"

strange bronze
icy frost
#

does it load or say Application Error

#

OH

#

well yeah

strange bronze
#

yea 😦

icy frost
#

gonna need to see ur repo structure

strange bronze
#

oki whats ur github!

icy frost
#

ss vscode or something

strange bronze
#

screenshare?

icy frost
#

or add me nebulatgs

#

screenshot

strange bronze
#

ok invited

rough thunder
#

i ‫ your mom ‫

icy frost
#

this is a code issue, i cant help yall with that

#

not a railway issue tho

strange bronze