B
B
beduin012017-10-19 20:57:45
Flask
beduin01, 2017-10-19 20:57:45

How is it customary in Flask to build a directory hierarchy?

How is it customary to build a directory hierarchy in Python? For example, I have a MyProj project, in it I create:
run.py
app/
/view.py
/module1/bar.py
/module2/baz.py

If I need to access view.py from run.py and then to bar and baz then how to do it?

It's just that unexpectedly __init__.py comes out here , which, as I understand it, is an analogue of the package entry point, or I don’t know how to call it.

What's the point in writing like this:

from flask import Flask

app = Flask(__name__)
from app import views


I understand correctly that by creating the __init__.py file in the folder, we actually create a package, inside this __init__.py we connect all the other libraries and then we do import app?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2017-10-19
@dimonchik2013

https://github.com/search?utf8=%E2%9C%93&q=flask

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question