Wie importiere ich aus der Konfigurationsdatei in Flask?Python

Python-Programme
Anonymous
 Wie importiere ich aus der Konfigurationsdatei in Flask?

Post by Anonymous »

Ich habe das Layout meines Flask-Projekts von http://blog.miguelgrinberg.com/post/the ... ello-world.

Die folgende Struktur:

Code: Select all

app/
__init__.py
views.py
forms.py
myFile.py
run.py
config.py
< /code>

In Views.py, forms.py Ich kann < /p>

verwendenfrom config import basedir
< /code>

Ich kann das jedoch nicht in myFile.py < /p>

Ich habe < /p>

hinzugefügtimport Flask
< /code>

und wenn ich es [url=viewtopic.php?t=12045]ändern[/url] kann, startet der Flask -Webserver, aber es heißt nicht, dass Änderungen in App /myFile.Py neu gestartet werden.from config import basedir
< /code>

In meiner Python -Datei. Ich sehe nichts Besonderes, das in __init __. py < /code> für forms.py.from flask import Flask
from config import basedir

app = Flask(__name__)
app.config.from_object('config')
from app import views

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post