在python烧瓶应用程序中相对导入一个apackage [英] Relative import of a apackage in python flask application
问题描述
其中包的描述为休闲
config --->数据库配置详细信息
flaskApp
1模型--->其中有mongodb模式
2 viewController ---->要访问的端点
<其中包含单个HTML页面,我只需要服务(不渲染它)
代码回购相同的是在github
https://github.com/dhanalakshmiZendynamix/python- Flask-relative-module.git
我遇到以下问题
1:我没有找到一个简单的方法来访问软件包到另一个软件包,如在文件夹结构(即viewController里面的模型,其中的终点是存在的) 2>不知道如何提供静态文件夹中的HTML页面
尝试读取多个源文件
a href =https://exploreflask.com/en/latest/preface.html =nofollow noreferrer> https://exploreflask.com/en/latest/preface.html
http://pyvideo.org/pycon- us-2014 / writing-restful-web-services-with-flask.html
但仍然不知道如何让它工作b
$ b
请帮忙采纳到上面的文件夹结构,并且进入到终点真的不知道该怎么去吧
任何建议和指针会有所帮助谢谢 解决方案
@dhana lakshm我
检查您的应用程序中注册的网址端点。
在项目目录的命令行中启动Python并执行以下命令:
>>> import flaskApp
>>> app = flaskApp.create_app()
>>> app.url_map
请将输出添加到您的问题中
我真的认为你需要先阅读一些关于python和flask的内容,这里有一些很棒的资源列表。 https://github.com/humiaozuzu/awesome-flask
Trying to make the sample flask application more modular,I am new to python and flask trying to build a sample application where , I have planned to maintain the folder structure of the application as shown below
where the description of the package are as fallows
config ---> database configuration details flaskApp 1 model--->which has the mongodb schema 2 viewController----> the endpoint to be accessed
static---> which contains the single html page which i just need to serve (not render it)
The code repo for the same is in github https://github.com/dhanalakshmiZendynamix/python-Flask-relative-module.git
I am facing following problems 1: I am not finding a easy way to access the packages to another packages as in folder structure(ie, models inside viewController where the end points are present)
2:Not sure how to serve the html page inside static folder
Tried reading many source https://exploreflask.com/en/latest/preface.html http://pyvideo.org/pycon-us-2014/writing-restful-web-services-with-flask.html
But still not sure how to get it working
Please help to adopt to the above folder structure and access to the end point really not sure how to go about it
Any suggestion and pointer would help a lot Thank you
@dhana lakshmi Check the registered url endpoints in your app. Start Python on the commandline in your project directory and execute the following commands:
>>> import flaskApp
>>> app = flaskApp.create_app()
>>> app.url_map
Please add the output to your question
And I really think you need to read up a bit on python and flask first, here is a list with some great resources on flask https://github.com/humiaozuzu/awesome-flask
这篇关于在python烧瓶应用程序中相对导入一个apackage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!