スタック・オーバーフロー Asked on November 18, 2021
https://github.com/cyrilrbt/canadian-nutrient-file
上記のリポジトリをCloneして使おうと思っていますが、Templateを編集しても更新されません。もちろんサーバーを再起動してます。
後、起動の仕方もRepoの説明ではなく、
python cnf/main.py runserver
を
Project/canadian-nutrient-file$
のメインフォルダーから起動してます。
単に"Hello World"的なフレーズを加えて試しているのですが、画面に表示されません。
プロジェクトのフォルダーTreeはこんな感じです:
├── base.cfg
├── bin
│ ├── buildout
│ ├── cnf
│ ├── pip
│ ├── pip3
│ ├── pip3.7
│ ├── python
│ └── wheel
├── bootstrap.py
├── buildout.cfg
├── canadian_nutrient_file.egg-info
│ ├── dependency_links.txt
│ ├── entry_points.txt
│ ├── not-zip-safe
│ ├── PKG-INFO
│ ├── requires.txt
│ ├── SOURCES.txt
│ └── top_level.txt
├── cnf
│ ├── __init__.py
│ ├── main.py
│ ├── models.py
│ ├── __pycache__
│ ├── scripts.py
│ ├── settings.py
│ ├── templates
│ └── views.py
├── cnf_csv
│ ├── CONVERSION FACTOR.csv
│ ├── FOOD GROUP.csv
│ ├── FOOD NAME.csv
│ ├── FOOD SOURCE.csv
│ ├── MEASURE NAME.csv
│ ├── NUTRIENT AMOUNT.csv
│ ├── NUTRIENT NAME.csv
│ ├── NUTRIENT SOURCE.csv
│ ├── REFUSE AMOUNT.csv
│ ├── REFUSE NAME.csv
│ ├── YIELD AMOUNT.csv
│ └── YIELD NAME.csv
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── develop-eggs
│ └── canadian-nutrient-file.egg-link
├── eggs
│ ├── coverage-4.4.1-py3.7.egg
│ ├── Flask-0.12.2-py3.7.egg
│ ├── flask_mongoengine-0.9.3-py3.7.egg
│ ├── Flask_Script-2.0.5-py3.7.egg
│ ├── Flask_Testing-0.6.2-py3.7.egg
│ ├── mongoengine-0.13.0-py3.7.egg
│ ├── nose-1.3.7-py3.7.egg
│ ├── pylint-1.7.0-py3.7.egg
│ ├── python_dateutil-2.6.1-py3.7.egg
│ ├── setuptools-33.1.1-py3.7.egg
│ └── zc.buildout-2.13.3-py3.7.egg
├── LICENSE
├── MANIFEST.in
├── parts
├── README.md
├── setup.cfg
├── setup.py
├── src
│ ├── pip-delete-this-directory.txt
│ └── webpy
└── versions.cfg
何かしらヒントもらえれば幸いです。
Main.pyはBootstrapを足して、def main()
をif __main__=="__main__":
に変えました。
from flask import Flask
from flask_mongoengine import MongoEngine
from flask_script import Server, Manager
from flask_bootstrap import Bootstrap
import cnf.settings
import cnf.scripts
# pymongo has issues...
warnings.filterwarnings("ignore", category=DeprecationWarning, module='mongoengine')
def setup_app():
app = Flask(
__name__,
template_folder=cnf.settings.TEMPLATE_FOLDER,
)
app.config.from_object(cnf.settings)
with app.app_context():
app.db = MongoEngine(app)
app.bootstrap = Bootstrap(app)
app.manager = Manager(app)
app.manager.add_command(
'runserver',
Server(
host=app.config['FLASK_BIND'],
port=app.config['FLASK_PORT']
)
)
app.manager.add_command('import', cnf.scripts.Import())
return app
'''
def main(): # pragma: no cover
app = setup_app()
# Import your views!
with app.app_context():
import cnf.views
#app.run()
app.manager.run()
'''
if __name__== "__main__": # pragma: no cover
app = setup_app()
# Import your views!
with app.app_context():
import cnf.views
#app.run()
app.manager.run()
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP