Giter Club home page Giter Club logo

Comments (11)

kevinburke avatar kevinburke commented on September 23, 2024

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.

bewt85 avatar bewt85 commented on September 23, 2024

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.

dougblack avatar dougblack commented on September 23, 2024

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.

bewt85 avatar bewt85 commented on September 23, 2024

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.

dougblack avatar dougblack commented on September 23, 2024

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.

bewt85 avatar bewt85 commented on September 23, 2024

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.

dougblack avatar dougblack commented on September 23, 2024

Awesome! I'm really glad this worked out for you.

from flask-restful.

nicholasamorim avatar nicholasamorim commented on September 23, 2024

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.

senseysensor avatar senseysensor commented on September 23, 2024

+1 to question above. Will this ever be fixed?

from flask-restful.

silasray avatar silasray commented on September 23, 2024

I just submitted a pull request to fix this.

from flask-restful.

marcoslin avatar marcoslin commented on September 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.