you forgetting flask-restless for that js MV frontend.
return redirect(url_for('dickroll'))
What was your everyday stack before Flask?
After three years of large projects on Rails, my current slew of sideprojects are much simpler. Mostly one-page apps or apps with simple front-ends that do lifting behind the scenes.
I've been enjoying Flask's brethren Sinatra (Ruby) and Express (Node) in production.
I'll go back to Rails in a heartbeat on a conventionally complex app with database associations, authentication, and the works. But I find writing glue code and plumbing to be intellectually stimulating on smaller projects when I have the time to write it, debug it, and shop for tools to hitch up. Feel like a kid in a candy shop.
Do you have any experience with Django?
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()
Hello World!
^^ is this a troll post??
Er... shouldn't the PHP be
::emp::
Flask is everything Django should've been. Initially, Django made a lot of claims about using modular components, but in my experience dealing with the overwhelming number of global settings and Django magic makes this more switching out components more trouble than it's worth.
Here's a simple use case:
Populate a DB with a scraper. Access that DB with a web app.
If I use the Django ORM in the web app, it's a good idea to use it when creating records with the scraper. So what, the scraper should depend on Django?
Using Flask, I can create one DB module that uses SQLAlchemy and is shared between the scraper and the app. So instead of writing Django ORM code twice or using prepared statements in my scraper that I hope match what the ORM expects, I just use a library that doesn't depend on a web framework.
Yes, you can use the Django ORM without Django, I've done it, but it's retarded.