Jump to content

dkobrin

Members
  • Posts

    5
  • Joined

  • Last visited

dkobrin's Achievements

Newbie

Newbie (1/14)

  • Dedicated Rare
  • First Post Rare
  • Conversation Starter Rare
  • Week One Done Rare
  • One Month Later Rare

Recent Badges

1

Reputation

  1. Soo as it turns out, on Jonny you can safely place your .env file in the root of your app and the server will automatically prevent it from being served to a client. for this sample project, the path is load_dotenv("/home/dkobrin.helioho.st/flask.dkobrin.helioho.st/MyNewFlaskApp/.env") as an extra layer of safety I am also adding the following to my .htaccess file instructing Apache to deny requests for .env files #hide .env files from http access <FilesMatch ".env"> Order allow,deny Deny from all </FilesMatch>
  2. Hi, Thanks for setting all this up and taking the time to support all of us! My questions is regarding properly setting up environmental variables for Flask. I have set up a sample (simplified) project to iron this issue out. https://flask.dkobrin.helioho.st/MyNewFlaskApp/ I have looked through the discord for advice on this issue and have located my .env file in a non-public folder /home/environments/MyNewFlaskApp/.env and added the path to my load_dotenv (and for debugging dotenv_values), but although pathlib verifies the file exists, there are no key value pairs loaded. I set the permissions for the .env to 644 although I think it should be 640... here is the server import sys from flask import Flask, __version__ from dotenv import load_dotenv, dotenv_values from os import environ as env from getenv_path import env_path # load environment vars load_dotenv("/home/dkobrin.helioho.st/environment/MyNewFlaskApp/.env") #env_path) config = dotenv_values("/home/dkobrin.helioho.st/environment/MyNewFlaskApp/.env") #env_path) config2 = dotenv_values("/home/environment/MyNewFlaskApp/.env") if env_path.exists: print(env_path) print('FOO is') print(env.get('FOO')) print(config) print(config2) app = Flask(__name__) application = app @app.route("/") def hello(): if env_path.exists: print(env_path) print('FOO is') print(env.get('FOO')) print(config) print(config2) return """ Flask is working on HelioHost.<br><br> <a href="/flasktest/python/version/">Python version</a><br> <a href="/flasktest/flask/version/">Flask version</a> """ @app.route("/python/version/") def p_version(): return "Python version %s<br><br><a href='/flasktest/'>back</a>" % sys.version @app.route("/flask/version/") def f_version(): return "Flask version %s<br><br><a href='/flasktest/'>back</a>" % __version__ if __name__ == "__main__": app.run() the sample base code does work so the .htaccess and flask.wsgi seem to be ok here is my log output I feel like I'm missing something simple here. Thanks again!
  3. Thanks, It does get past the module problems and into other migration errors... I'll have to keep digging for now, but thanks for the help!
  4. Thanks Krydos, but I only see 2 of the 3 modules in the list now and the 3rd is still erroring. 2025-07-11 04:05:01 Error 108.5.89.173 from flask_talisman import Talisman Apache error 2025-07-11 04:05:01 Error 108.5.89.173 ModuleNotFoundError: No module named 'flask_talisman'
  5. Hi, First off I'd like to thank all of you at Heliohost for putting in the time and effort to share this service with all of us. I'm migrating a flask app from a previous hosting site and I use a few modules that aren't already loaded on Jonny. Authlib flask-talisman peewee I'll update to work with the latest versions of these, and if there is a reason to avoid them please let me know. username : dkobrin server : Jonny python ver : 3.12
×
×
  • Create New...