Comments (11)
Thanks for sharing your experience! To be honest we're not that familiar with blueprints so it's good to get some feedback on how it works. If you can wrangle pull requests, that's probably the best way to share. Otherwise, paste the new TODO somewhere - maybe gist.github.com - and we can take care of merging it.
from flask-restful.
Thanks Kevin and apologies for the delay getting back to you.
I have a feeling that I'm misunderstanding blueprints in that case; what I was trying to do was split my app over a few different files.
Here is a toy example which adds a list of "done" tasks as well as todos so that you can see what I mean.
I'm happy to do a pull request if this does look like the right way to do this but I'm pretty sure it's not!
Cheers, Ben
from flask-restful.
Thanks for looking into this!
If you aren't comfortable this will work out I'm going to go ahead and close. If you think of a good way to do this and want to take another stab at it feel free to reopen!
from flask-restful.
Oh sorry, what I wanted to do was to split a project over a few files and (being new to Flask itself) figured blueprints seemed like the way to go.
When I tried to do this with Flask-Restful it seemed like this was not a natural way to achieve this because, in this case, I ended up having to trick some sort of error handling code which is clearly wrong.
What I'm looking for is a way of splitting a project up across a few files; the gist demonstrates an attempt which works but doesn't seem right. Any other avenues I could look down would be warmly received.
Cheers, Ben
from flask-restful.
Hmm. I work on a pretty large flask-RESTful project and we haven't had issues with splitting the app across multiple files.
We basically have one routes.py
file that has all the api.add_resource(Resource, "/resource")
... calls. This lets us define all of the different resources in their own files and it keeps the code pretty clean.
I'm having trouble imagining an example where blueprints would really come in handy. I'm not saying I think they're never useful, just that if you explained your setup a little more clearly I might be able to reason about this problem a little better and decide how and if we want to better support Blueprints.
Looking forward to your insight!
from flask-restful.
Ahh I see; I was over thinking this. I think the answer you've given is to do this (which works nicely).
Thanks for your help, Ben
from flask-restful.
Awesome! I'm really glad this worked out for you.
from flask-restful.
Hi, everyone, very nice project you have in hand, first of all.
Will this ever be solved ? I have a project that uses Blueprint and I'm running into this issue. will this ever be fixed ? Why so many extensions breaks with blueprints ? I used to thought that if Blueprints are a native feature of Flask, all extensions would support it by default. Does blueprint works that differently ?
from flask-restful.
+1 to question above. Will this ever be fixed?
from flask-restful.
I just submitted a pull request to fix this.
from flask-restful.
Looking forward for #136 to be merged allowing the use of Blueprints. Living with hack from #18 right now.
from flask-restful.
Related Issues (20)
- how to get request.files attribute after flask send_from_directory?
- Return custom error code HOT 1
- Swagger doc like FastAPI HOT 2
- Did not attempt to load JSON data because the request Content-Type was not 'application/json'. HOT 8
- Is expected behavior of flask_restful abort() correct ? HOT 1
- Question: optional/wildcard url parameter HOT 1
- Flask 2.3 Incompatibility: app.propagate_exceptions is depreciated HOT 1
- test_client.get() with query_string doesn't work HOT 1
- The app.propagate_exceptions will be deprecated in Flask 2.3
- Using reqparse.add_argument() with default location parameter to parse requests with Content-Type other than "application/json" raises an exception when using Werkzeug>=2.1.0 HOT 3
- @api.resource is used in blueprint that it is not working HOT 1
- test_redirect failure HOT 1
- sdist is missing `tox.ini`
- This is alive? HOT 1
- response header "Server' cannot modified
- Is flask-restful dead? HOT 2
- Questions about Copilot + Open Source Software Hierarchy
- Documentation out of date for compatible Python versions
- Flask-RESTful breaks with Flask 2.3 and newer HOT 1
- Frontlight debug issues
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-restful.