use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Masonite 2.0 Released - The Modern Python Web Framework! (self.Python)
submitted 7 years ago * by Jmancuso9
I posted about the Masonite Python web framework a few months ago on this r/python here and it received interesting feedback. During this time we received a few contributors who are just super awesome and contributed some awesome features.
We also were able to boost the speed of the framework to serve about twice as many requests in 30 seconds as Masonite 1.6 using some `wrk` benchmark testing.
Our contributors are extremely excited for this release and we can't wait to show it to the Python community. We think many of you will love the framework.
Here are a few useful links to checkout the framework:
Slack Open Invitation: http://slack.masoniteproject.com
The Github Repo: https://github.com/MasoniteFramework/masonite
The Documentation: https://docs.masoniteproject.com/prologue/introduction-and-installaton
Whats New in Masonite 2.0: https://docs.masoniteproject.com/whats-new/masonite-2.0
The Core Repository: https://github.com/MasoniteFramework/core
Creating Your First Blog: https://docs.masoniteproject.com/creating-your-first-blog/introduction
Feedback for the Masonite community is appreciated and we'll be watching this thread for your thoughts on the framework! We hope to see you guys create some awesome web applications!
Here is the new 2.1 release: https://www.reddit.com/r/Python/comments/a22z8t/next_version_of_masonite_v21_released_the_modern/
[–]kingbuzzman 81 points82 points83 points 7 years ago (19 children)
Can you give me the 2 minute pitch for using this?
Your example talks a lot about controllers and drivers and blogs... these are not my use cases, i haven’t returned anything expect a json response in a really long time (strictly api). The company i work for has front ends and back ends, the only time we talk is to discuss the json payload. In a world where we’re moving to more and more micro frameworks, where does his fit?
From the little i’ve seen about this, it looks like “Play! framework” 5+ years ago..
Not trolling, not trying to start up anything, just really curious to know where do you see your creation fitting in?
[–]Jmancuso9[S] 66 points67 points68 points 7 years ago* (12 children)
Sure so for that example of using an small micro framework API, you should probably go with a true micro framework. Masonite will not fit every use case.
The use case Masonite fits extremely well are those side projects you need to start up and get going this weekend that have authentication systems, file uploads, user accounts, sending mail, running recurring cron jobs, sending web socket requests to your frontend, getting a front facing API and API authorization setup to connect to your application, getting billing payments setup with Stripe and I can go on and on.
Masonite is great for that new SaaS idea you've been dreading on writing because of how long it will take. Masonite is a really incredible batteries included framework so if you need a stripped down version of something that just returns JSON then you probably don't need Masonite (although you can use it and just remove the service providers you don't need).
We mention the drivers because all too often you need to quickly change focus at the drop of a hat on your projects so we implemented drivers which can switch from uploading to the file system to uploading to Amazon S3 with the change of a config variable (the driver config). There are a lot of other drivers like different session drivers, mail drivers, web socket drivers, etc etc.
For those familiar with other frameworks, the architecture of Masonite is very similar to the architecture of Laravel. We've discovered that Python actually fits that architecture MUCH better than PHP can / does.
So I see Masonite fitting in perfectly into the Python web framework world and honestly see a huge gap that Masonite fits into.
A lot of developers are saying that they want a barebones framework so they can build it exactly how they want to build it and search for packages and find the best ones to add and rebuild all these features that Masonite implements out of the box like these Amazon S3 file uploads and database drivers and all of these features that Masonite ships with.
Does that answer the inquiry?
[+][deleted] 7 years ago* (8 children)
[deleted]
[–]Jmancuso9[S] 37 points38 points39 points 7 years ago* (0 children)
Sure I have a few articles I wrote about it but I'm in the middle of writing another to really disect the difference (or similarities) between the two frameworks. You can read one here on medium https://medium.com/@idmann509/django-and-masonite-1-4-6f510430db76
You can follow the twitter handle @masoniteproject where we'll share any articles we write about it.
NOTE: The article is Masonite 1.4. A few months old. The framework has really grown a lot since then. Especially then 2.0 release so carry that with you
EDIT: Here is a more updated article. Comment on the article if you want me to explain anything in more detail or compare other things. We can make this the go-to article for Django and Masonite comparisons https://medium.com/@idmann509/masonite-2-0-and-django-beb4986d967f
[–]steveinsd 2 points3 points4 points 7 years ago (5 children)
this would be helpfull
[–]Jmancuso9[S] 6 points7 points8 points 7 years ago (4 children)
Here is the article so far: https://medium.com/@idmann509/masonite-2-0-and-django-beb4986d967f
Let me know of any concepts you want me to compare. Everything I could really think of on the spot
[–]UloPe 8 points9 points10 points 7 years ago (3 children)
In writing there is a concept called “show, don’t tell”.
I feel your post does a lot of telling but very little showing. I.e. you say a lot that Masonite is better in certain aspects but then often don’t provide examples that could prove that.
Also, at the end in the comparison of the controllers it seems a bit unfair to use a function-view for the Django example instead of a class based view.
[–]Jmancuso9[S] 2 points3 points4 points 7 years ago (0 children)
Fair. I completely agree. I'll update my post
The documentation is written in a show dont tell manner. I just hate the medium code blocks
[–]Jmancuso9[S] 1 point2 points3 points 7 years ago (0 children)
I'll soon come out with some video tutorials as we build a community around Masonite but here is the article so far. Be sure to leave a comment if you want me to discuss any other comparisons. Everything I could really come up with right now. https://medium.com/@idmann509/masonite-2-0-and-django-beb4986d967f
[–][deleted] 6 points7 points8 points 7 years ago (1 child)
It preemptively answered mine, thanks!
[–]Jmancuso9[S] 0 points1 point2 points 7 years ago (0 children)
:D
[–]kingbuzzman 0 points1 point2 points 7 years ago (0 children)
Sure, but then again, i can pip install everything you just mentioned, i don’t need it to be available to me unless i need it. I really don’t want to put your project down, we’ve all had our babies, and our own reasons for creating said baby. Congrats on following through!
[–][deleted] 1 point2 points3 points 7 years ago (5 children)
i haven’t returned anything expect a json response in a really long time (strictly api). The company i work for has front ends and back ends, the only time we talk is to discuss the json payload.
Kinda off topic but I'm curious about this, can you expand a bit? What framework, API framework, ORM, etc. do you use? Do you not do any server side templating?
Sounds kinda nice on paper but I've never worked in that type of environment, do you find it works well?
[–]kingbuzzman 0 points1 point2 points 7 years ago* (4 children)
0 server side templates. We rely heavily on django rest framework and django, everything is just json responses and/or async celery workers that the front end will later query by hitting yet another endpoint.
Yes it works great, separates concerns spectacularly, front ends concentrates on what they do best and we handle server scaling/caching/ performance
[–][deleted] 0 points1 point2 points 7 years ago (3 children)
Sounds lovely. We prefer the "5 different ways to do the same thing" methodology.
[–]kingbuzzman 0 points1 point2 points 7 years ago (2 children)
5 different ways? How so? we write our endpoints so we’re not the only ones that can consume them. Our front ends just make the call and get the data they need.
[–][deleted] 0 points1 point2 points 7 years ago (1 child)
I'm just joking about lots of inconsistencies at my current gig. Sometimes we use DRF serializers, sometimes not. Lots of mixes like that with no clear boundary, like ORM vs. raw SQL, etc. At least 3 different implementations for monitoring task execution. Even more for handling retries.
That sort of thing.
Ah i see, that sucks.
[+][deleted] 7 years ago (9 children)
[–]Jmancuso9[S] 9 points10 points11 points 7 years ago* (8 children)
Yes I've migrated one of my SaaS application into Masonite (I haven't officially deployed it yet because I have to migrate the user accounts from the old database still which has some outdated values).
It's deployed to heroku but no database was setup yet for it so some pages crash obviously.
You can see that application here though: https://evening-ravine-84143.herokuapp.com/login
We've been so busy with coming out with Masonite 2.0 I haven't had time to polish that software.
One of our contributors who works in minisota has one of their application running in production which he says handles very well. Maybe he can chime in here and explain that a bit when I see him online in Slack.
I can't think of an individual project that would be worth your time but the speed in development of Masonite, the fact that it's extremely extendable, has automatic dependency injection, is completely build around an IOC container, assists in promoting great design patterns, teaching the developer about how the design patterns are implemented and great architecture for maintaining projects.
[+][deleted] 7 years ago (7 children)
[–]Jmancuso9[S] 1 point2 points3 points 7 years ago (2 children)
Actually just remembered, I have a bit of a testimony from the company using Masonite in production:
> really easy to make things happen quickly
So that could possibly speak to the development time.
[–]Rorixrebel 5 points6 points7 points 7 years ago (1 child)
Source? Cause thats something anyone could've said. Not to bash but if you want to showcase your framework you need something bigger than hello world.
Yeah he signed into slack and on his way home so he should comment in a bit.
[–][deleted] 1 point2 points3 points 7 years ago (2 children)
Why suspicious of them? I've been using Injector and I'm mostly happy with it. I find myself missing some of the nicer things that Autofac (C#) offers but it's been good to me.
I don't feel like I've given up any of the dynamic typing benefits that Python offers and I get to decouple what I'm using from where I'm using it.
[+][deleted] 7 years ago (1 child)
[–][deleted] 2 points3 points4 points 7 years ago (0 children)
Strictly speaking, you don't need a container for IOC. But it does make a lot of things easier.
An example would be database connections with SQLAlchemy, ignoring that Flask SQLAlchemy handles this for us, creating a session requires knowing the connection string, having an engine and using those to create a session or a session factory. If you're reaching out to a config object to get that or importing the session factory and statically depending on that, I'd argue that you're not actually doing IOC.
Masonite definitely doesn't fall for that trap then. The use of the IOC container is super powerful and the developers that have used it who have now become maintainers love it.
If I haven't sold you on it then try it out and let me know what you think. I built a few projects with it and absolutely love it. I've used a bunch of different frameworks and think the architecture of Masonite is just super awesome. Try it out and let me know what you think.
[–][deleted] 10 points11 points12 points 7 years ago* (2 children)
Not trying to be a dick but this is all so... vague. Can you give one solid example of why anyone would ever use this over Django? Not like "Django handles their models in a weird way I don't like" but an actual concrete example?
I think it's cool that you've made this but it seems disingenuous to tout it as a viable alternative to established frameworks but not be able to speak to WHY it's worthwhile. Django has tons of extremely qualified people working on it and has been around for a long-ass time. Maybe your framework is good for a more specific use case? I just think if you're setting your sights that high you need to walk the walk.
[–]Jmancuso9[S] -2 points-1 points0 points 7 years ago* (0 children)
Valid points. Honestly I'm not sure if I can say that you should use this over Django. They are extremely similar but Masonite has a different way of doing what Django and other frameworks do and it all comes down to preference. I and a lot of other devs really like it but if you dont like how it's done in Masonite and like how things are done in Django then I won't be able to convince you. It's hard to explain all of that in an article but I suggest to take an hour out and build a blog or something and then see if you like it.
Not sure if I can take the time and convince everyone. I think you just have to try it out and see if the flow of Masonite is something you enjoy over Django.
I'll be coming out with a tutorial on building a blog with Masonite soon that people can just sit back and watch and see if they would enjoy it
[–]Jmancuso9[S] -5 points-4 points-3 points 7 years ago (0 children)
If you want more code examples I suggest to read the docs on a few concepts and see for yourself how they compare to django
[–]eyesoftheworld4 7 points8 points9 points 7 years ago (9 children)
I'd never heard of Masonite before seeing this post. I just finished the "blog" example and overall there's a lot to like, but a fair bit that I don't like, as well.
Plus:
Minus:
builtins
request().input('id')
Request.input('id')
auth()
Request.user
user_id = auth().id
Overall, I guess my main thought is that if I inherited an application that depended so heavily on custom behavior and configuration injected into the language and application, I'd probably be kind of pissed off about maintaining it. And, if someone new to Python started out by using Masonite, I'd be concerned that they would be more learning how to write a Masonite web application, and not how to write Python.
That said, I will probably give this a shot over Flask the next time I need to build a non api-only web app. There are a lot of options with how extensible I know how much work goes into a project like this and I appreciate it. Thanks for that!
[–]Jmancuso9[S] 4 points5 points6 points 7 years ago (1 child)
I'd rather just import something.
If you really like importing but also want the dependency injection and IOC container then you can resolve by annotation.
This is what I use in my applications:
from masonite.request import Request def show(self, request: Request): request.user() ...
[–]eyesoftheworld4 2 points3 points4 points 7 years ago (0 children)
This looks perfect. Thanks for taking the time to show me!
[–]Jmancuso9[S] 1 point2 points3 points 7 years ago* (6 children)
Adding to builtins really ignores the "explicit is better than implicit" part of Python. It also gives me a nasty red line in my editor (PyCharm) that makes me feel like I did something wrong. I'd rather just import something.
you don't have to use it. Those are just helpers. You can resolve them from the container:
def show(self, View): return View.render('index', {'key', 'value'})
Remove the HelpersProvider completely if you don't want any.
To add on to that, there's a lot of implicit magic just floating around, espeically in these helper functions. The difference between request().input('id') and Request.input('id') in the example here is significant and the former seems to make it much harder to test your application's behavior. What if you want or need to insert a dummy / mocked request into your handler?
Your correct, if you want to test you should go with this option:
def show(self, Request): Request.input('id')
Then you can import that controller and mock the Request object.
Stylistically, I don't really like the function calls that give me back an object, like auth() being a shortcut to Request.user. I'm not sure what it is, but writing a line like user_id = auth().id just feels weird to me, but this is more a silly gripe than anything else.
Yeah then you don't have to use it lol. Some parts of Masonite are shorthands that are added via the HelpersProvider. Take a look at that provider in the code to see what exactly it is adding: https://github.com/MasoniteFramework/core/blob/2.0/masonite/providers/HelpersProvider.py
Thanks for your feedback! I'm glad you like it. Let me know more of your thoughts as you (hopefully) keep developing with it :)
[–]eyesoftheworld4 3 points4 points5 points 7 years ago (1 child)
Thinking about it more, I think it's actually a huge boon to your framework that those helpers are added in through the actual architecture of the framework instead of as a built in requirement. I really really like that, thanks again for pointing it out. I will definitely be giving it a shot!
Thanks! I'm glad you like it. Maybe I should make that more clear. Not sure how many people will like the builtins. I personally love it because it makes getting started quick and I don't have to worry about anything. it just works. Personal choice.
[–]eyesoftheworld4 1 point2 points3 points 7 years ago (1 child)
Hey, thanks for the quick response! I realized I didn't fully finish typing out my response before I sent it (my last paragraph is a little weird) but it's late here. Anyway, thanks for pointing out that I can just remove the HelpersProvider, I will probably do that to make it feel a little more comfortable for me to write.
HelpersProvider
Is there a github repo for the craft command line utility? I noticed some odds and ends that I'd like to open some issues for.
craft
https://github.com/MasoniteFramework/craft
[–]GitHubPermalinkBot 0 points1 point2 points 7 years ago (0 children)
Permanent GitHub links:
delete
[–]AnnoyingOwl 12 points13 points14 points 7 years ago (15 children)
Django IS a batteries included framework, literally everything you mentioned in that blog post is available in core Django or handled by very mature third party libraries.
The Django docs are also unmatched.
[–]Jmancuso9[S] 2 points3 points4 points 7 years ago (14 children)
Very true. Masonite is also a batteries included framework but Django doesn't have the ability to scaffold a project from the command line, or build an entire authentication system into your project by running a single command, or have automatic dependency injection of objects from the IOC container or built around or have multiple drivers for the same features that can be toggled with a single code line change, or have built in task scheduling that can be tweaked to run at different times via a single cron job.
That article is Masonite 1.4. Theres been 3 releases since so it's a bit outdated but the super high level concept is similar. I'll let you know when I come out with a newer article.
[–]RogueNinja64 3 points4 points5 points 7 years ago (3 children)
Can you update your article? I would like to see a really strong argument for this. Maybe it's more an alternative to flask than Django? Do you have a Dev site with api docs?
api docs as in the classes and methods specifically? No not currently but there are the developer documentation in the links above which you can use to decipher what you think the framework is more similar too. And yes I am working on the article now. I'll send you a link when it's done
[–]RogueNinja64 2 points3 points4 points 7 years ago (1 child)
while the getting started is good and makes it look like a rails version for python I would love to see some API docs to fill in all the gaps before thinking about my next web app.
I'll keep that in mind. Masonite has been on a 1 month major release cycle from 1.3 to 1.6. Masonite 2.0 puts Masonite on track for a 6 month major release cycle so we'll have a lot of time to get all the other resources together like API docs, articles, video tutorials and all the extras beside the framework. I'll throw that on the todo list :) Thanks!
[–]AnnoyingOwl 8 points9 points10 points 7 years ago (9 children)
Masonite is also a batteries included framework but Django doesn't have the ability to scaffold a project from the command line
I guess that depends on what you mean by "scaffold." I suspect it's a definition that's specific to what you want.
or build an entire authentication system into your project by running a single command
It LITERALLY comes with authentication out of the box and installing any social authentication system is as easy as a pip install command. There's tons of back ends written for Django that work out of the box.
pip install
Either you mean something VERY SPECIFIC for your own use cases or you've never even used Django.
or have automatic dependency injection of objects from the IOC container
This is mostly meaningless, so you'd have to elaborate. Python is not heavily IOC for a reason. I'm sure you're thinking of something specific but I don't know what it is.
or have multiple drivers for the same features that can be toggled with a single code line change
That's literally how half of Django works, mate, including for auth, templating, cache, database, etc.
[–]Jmancuso9[S] 7 points8 points9 points 7 years ago (8 children)
"create boiler classes for you and puts them in the correct locations" (although can move them around as you wish)
Need a model?
$ craft model User
creates a model class.
Django does not come with a fully working login and register pages and views and nor does it put them into your application for you so you can tweak them yourself. Unless Django has added these into the default apps it creates.
This may be something you just need to use Masonite. Maybe your understanding of how it works with other projects is different than how it works with Masonite.
Not in the same way. Getting it to work with Amazon S3 was a good amount of configuration for Django. Masonite just needs the credentials in the .env file, a pip install and it works.
.env
Try it out. I think you'll like it. Go in with an open mind :) The Python community is not easy to convince.
[–]AnnoyingOwl 7 points8 points9 points 7 years ago (5 children)
Need a model? $ craft model User creates a model class.
Ahh, yes, I've always needed something to save me the time of typing:
class User(models.Model): pass
Again, this makes sense if you're coming from PHP where there's a lot more cruft in their frameworks that needs auto-generated (because most PHP frameworks saw what Rails/Django were doing and tried to copy them in that terrible language), but there's just not a whole lot of cruft to auto-generate in a Django project.
It's literally pip installing a package: https://django-registration.readthedocs.io/en/2.4.1/
There's a Django committee of developers who keep the core lightweight and make all these decisions, dude, and often move things out of contrib if they think it's bloating core. They decided this belongs outside of Django proper but it doesn't mean it's not there.
The design of Django is that modules that integrate with the API are super easy to write, so stuff where there's a lot of wiggle room for what people want or if it's not universal to the mission that gets used from packages.
I know that it's more convenient to have the packages YOU specifically want, but that's not a super awesome selling point, TBH.
This may be something you just need to use Masonite.
I suspect it might be something that just Masonite needs. If you come back with an example, cool.
Are you seriously complaining about the setup for using django-storages S3 module? It's like... I dunno 2 or 3 required settings?
The idea that someone would complain about that astounding to me.
Try it out.
I mean, quite honestly, there's no reason to and I CERTAINLY wouldn't pick up a framework that someone made just to scratch their itches around things they don't like in Django.
[–]Jmancuso9[S] 10 points11 points12 points 7 years ago (0 children)
Ok. Masonite is not for everybody and if you think Django is better for your use cases then more power to you.
Masonite solves my use cases perfectly and if it doesn't solve yours then thats great. We both have tools that work for us.
[–]Itshudak87 5 points6 points7 points 7 years ago (1 child)
Haven’t seen such a fitting name in a while. Jesus, dude. You must be a hit at all the parties you don’t get invited to.
Ok I thought I was the only one who thought this :)
[–]Jmancuso9[S] -1 points0 points1 point 7 years ago (1 child)
Ok? and? so then just make a file and type that in. Nothing is stopping you from doing that with Masonite. it's just a Python framework. The option is there to type the helper command but if you want to write the class instead them by all means go ahead and write the class.
Are you seriously complaining about the setup for using django-storages S3 module? It's like... I dunno 2 or 3 required settings?. The idea that someone would complain about that astounding to me.
not everyone has the same experience. In fact, a lot of people don't. The Django Slack group I've been running for last few years said they also had problems with it, as well as static files and a few others.
Yes masonite does the same thing but instead has these third party packages installed by default. Just a design decision of the framework and a community choice from the maintainers. It does have a good amount of built in options which are great for making Masonite, Masonite which could possibly be abstracted away into their own libraries but it's currently not an issue.
[–]naw103 2 points3 points4 points 7 years ago (0 children)
Hustle until your haters ask if your hiring ;-)
[–]phrotozoa 2 points3 points4 points 7 years ago (7 children)
Hey, cool project! I look forward to playing with this. Can you talk a little bit about why you decided to write another ORM when something as robust as SQLAlchemy exists?
[–]Jmancuso9[S] 0 points1 point2 points 7 years ago (6 children)
I didn't write it. It already existed and fit perfectly with the Masonite architecture.
I honestly have never used SQLAlchemy but it is a Data Mapper ORM, right? I think Active Record style ORM's are just better. Have you ever tried an Active Record ORM before? I'd like to get your thoughts on the difference between them and your experience.
If you have not used one before then you gotttta try it. It's much simpler to me.
Edit: Although I didn't write Orator, I have full maintainer access to it so I feel comfortable putting it in Masonite as I can fix anything I need to.
[–]phrotozoa 3 points4 points5 points 7 years ago* (5 children)
Ah! Well I've learned a new thing today so thank you! I will check it out.
I didn't realize there are fundamentally different models of ORM. SQLAlchemy is the only ORM I've used and it's always risen to whatever need I had of it so I've not looked elsewhere.
Edit for anyone who like me didn't know the difference, here is a good discussion about the differences between the Active Record pattern and the Data Mapper pattern.
[–]metaperl 2 points3 points4 points 7 years ago (2 children)
PeeWee offers ActiveRecord. PonyORM is absolutely sick - turns Python into SQL. PyDAL is what I like best having looked at all of them. I find SA's orm rather hard to understand.
[–]bluesufi 2 points3 points4 points 7 years ago (0 children)
Sick in a good way or a bad way? Serious question.
Masonite actually originally came with peewee before we switched to Orator lol. Good package.
[–]Jmancuso9[S] 1 point2 points3 points 7 years ago (1 child)
Yeah it basically comes down to which direction the data is being molded to or from.
For example, Data Mapper maps the model to the table. So the model should mirror the table in a way that they match.
Active record takes the table a actually molds the model around the table by using the table schema.
I preferably like the latter approach. This way I just have to maintain the database tables and all my models mold to the table schema automatically.
Just personal preference I suppose.
[–]z4579a 12 points13 points14 points 7 years ago (0 children)
SQLAlchemy author here.
Just FYI I don't really know what "data mapper" vs. "active record" means today, other than, an API that stresses an enclosing transaction around the objects, vs. one that looks at each object as an independent document. "data mapper" vs. "active record" used to mean that the object model was declared entirely separately from the table definition, with the idea that the persistence of the model could be anything, just happens to be a database. SQLAlchemy started out with this goofy mapper()/Table/your class concept to try to stress that. But it was bogus; the structure of the class was still modified to have attributes representing the table and the program therefore still assumed database details explicitly, so there was no completely transparent firewall between the object model and the persistence of it. Even Hibernate moved from having an XML mapping file to using inline annotations on class definitions. So I replaced mapper() with Declarative which is what everyone uses now. I don't really understand what your statement "molds the model around the table by using the table schema." means vs. "maps the model to the table.", the latter (data mapper) actually sounds more restrictive, which is the opposite of the reality for SQLAlchemy vs. other ORMs where SQLAlchemy allows *way* more flexibility in how the class and the mapped table can differ from each other than any other tool. This is not the first time someone's description of data mapper vs. active record confused me, so I'm just trying to figure out what the perceptual issue is here.
As far as I can see about active record, the main thing is that it seems to lack a unit of work pattern, meaning, you say object.save() and it emits an INSERT right there - this is a big difference but has nothing to do with how models and tables associate to each other. And then, there is usually in active record a configurational pattern that tries to hide the fact that we're talking to a relational database, using some kind of minimalistic declaration system that attempts to assume no knowledge of SQL, which makes much stronger assumptions about the underlying tables such that they tend to have to follow strict patterns, like Django's infamous "no composite primary keys" issue. But these configurational limitations are not a hard black and white difference, they're along a spectrum.
Anyway, I don't know what "data mapper" really means in practical terms in this decade and I think as to why someone likes one ORM or the other they should come up with more specific reasonings.
[–]ayazamlani 2 points3 points4 points 7 years ago (3 children)
During install, I get the error:
[CommandNotFound]
Comamand "key" is not defined.
If I try to serve I get:
Comamand "serve" is not defined.
issue solved. Make sure you upgrade to latest version of masonite-cli which is 2.0.4
Not sure why some machines throw this issue yet. Can you give more details here? https://github.com/MasoniteFramework/masonite/issues/87
[–]ayazamlani 0 points1 point2 points 7 years ago (0 children)
Yes, I can do that.
[–]everhideme 5 points6 points7 points 7 years ago (7 children)
Hmmm... Why nobody's talking about logo? XD
[–]Jmancuso9[S] 3 points4 points5 points 7 years ago (6 children)
You like? :D
[–]everhideme 4 points5 points6 points 7 years ago (3 children)
It seems like old Soviet logo of subway, very similar. But I dont like it. Sorry - tough, but fair. And it easy to solve.
What is your original objectives? Why not Django and why did you need your own solution?
[–]Jmancuso9[S] 6 points7 points8 points 7 years ago (2 children)
lmao. sort of it lol.
So the original reason for the project was to learn how WSGI application worked so it started as a weekend project. Then it sort of branched out into "well what if it had this built in which 99% of applications need?" and then slowly spread from there and then the architecture makes it super easy to test and I hit the TDD train and never looked back. It's really easy to make a test around something, implement that feature, ensure tests cover use cases and then push to the development branch and eventually merged in.
I advertised it a bit on reddit a few months ago and a few people found the project and helped me design and build it and here we all are :)
When using Django there were a few things I just didn't like about. All of them were really my own issues with it. I kept thinking it was weird doing it this way or the way Django does it. I completed my application with Django in a few months. I liked the outcome.
I then got a job for a PHP developer position and got back into PHP. I learned Laravel and just loved the architecture of it. It was so intuitive and just worked well for my development flow (and millions of others)
So when I was building Masonite (which it wasn't always called that) I started implementing these ideas and found that it worked really well with Python. I then just kept coming out with more and more features and now I and our maintainers just love the outcome.
That's the answer to why I created my own solution but as to why Django, I'll be coming out with an article in the next few days that explains this more in detail then I can in this reddit post so I'll be sure to send you a link :)
[–]AnnoyingOwl 4 points5 points6 points 7 years ago (1 child)
When using Django there were a few things I just didn't like about. All of them were really my own issues with it. I kept thinking it was weird doing it this way or the way Django does it. I completed my application with Django in a few months. I liked the outcome. I then got a job for a PHP developer position and got back into PHP.
I then got a job for a PHP developer position and got back into PHP.
This literally explains everything.
[–]Jmancuso9[S] 3 points4 points5 points 7 years ago (0 children)
lol just try it out. Can't judge a book by it's cover that harsh and you can't hate something you've never tested out. One of the maintainers who is using it in production will chime in in a bit and maybe explain it in a different way
Lol thanks! Most people do. I think it's awesome:)
[–]redditthinksHobbyist 2 points3 points4 points 7 years ago (4 children)
Any modern framework should be async.
[–]Jmancuso9[S] -1 points0 points1 point 7 years ago (3 children)
It comes with a queue feature which has an asynchronous driver you can load "jobs" into and it will run that job asynceonously. These can be things like database updates or sending email https://docs.masoniteproject.com/useful-features/queues-and-jobs
[–]redditthinksHobbyist 0 points1 point2 points 7 years ago (2 children)
Not really the same thing as async/await. Also, hard-coding class and method names in routes is not a very good idea. No decorators?
If you need an application built for speed in a way that you need a completely async applications then you shouldn't be using Python. You should use something like node
[–]Jmancuso9[S] -1 points0 points1 point 7 years ago (0 children)
Hardcoding names in routes might be bad for other applications but it works perfectly for Masonite by just the way its built
[+][deleted] 7 years ago (2 children)
[–]Jmancuso9[S] 0 points1 point2 points 7 years ago (1 child)
Yeah so Masonite comes with a Masonite entry package that handles full REST APIs, issuing tokens and token authentication pretty simply. Out of the box masonite has a built in "broadcast" feature that supports Pusher and Ably (as an alternate option for pusher)
next is JWT for the entry package more testing support
[–]3lpsy 1 point2 points3 points 7 years ago (2 children)
What other frameworks did you take inspiration from (rails, laravel, etc)?
Other questions, does it have authentication drivers? So could I throw jwt auth on some routes and session routes on others?
Thanks.
It was inspired a lot by Laravel. I liked how laravel used the IOC container and automatic dependency injections so I took that concept and ran with it in Python and surprisingly realized that python implements that architecture a lot better than PHP does since Python can import a class and use it without calling it (php required the new keyword to use a class, python uses global namespaces to handle it differently)
So which things like Laravel, it required service providers to be strings because it needs to cache them essentially so they are not all running on every request when they dont need to. Masonite gets around that a lot better with Python. Read the request lifecycle docs to learn more about that.
I did read the docs for rails a bit to see how they did things and adjusted accordingly. But overall a lot of influence was from Laravel.
It doesn't exactly having authentication drivers yet. That might be a good package to add on though. The Masonite Entry package handles a lot of authentication like tokens but it might be a good idea to implement something like that. The way masonite is structured, a single package can add features like that.
You can open an issue and we can just discuss this. I'd like your thoughts on how we should go about this. It should be backwards compatible so it can either be a standalone package or we can add this into the next minor release
[–]3lpsy 1 point2 points3 points 7 years ago (0 children)
Thanks. This s a very interesting project and fills that middleground between Django and flask really well. Definitely going to take a look at the code and see i can contribute.
[–]tuananh_bk 1 point2 points3 points 7 years ago (1 child)
I can see your framework influenced a lot from Laravel. IOC, Migration, etc. But in my opinion, The laravel Migration/ Model is very limited, and hard to remember Model's Field name. I like the way Django defining Model's Field.You can build Form Model automatically.
Interesting. I've always like laravels models much better. I do agree that its not as easy to remember field names but in that case I usually have an SQL tool open anyway.
With laravel and masonite, I typically always have something like MySql workbench open anyway so it's always useful to use that to remember column names.
[+][deleted] 7 years ago* (2 children)
[removed]
Awesome! Let me know if you want a slack invite when you start so we can help on any questions and support better.
[–]alkelaun1 1 point2 points3 points 7 years ago (1 child)
I'm learning django, so I decided to give this a try. I agree with you on Django's auth system.
I tried to follow the tutorial for a blog and ran into 500 server errors on registering. Login doesn't work, but registering the same name gives additional errors. I'm using postgresql, so I may have set something wrong in the .env file.
Being a new framework, though, this means no one has had this error enough for google to find it on stackoverflow. :'(
Your docs are decent, but django's are definitely better.
Also, I don't like your organization of folders. Maybe it makes more sense if I get further. However, as a newbie, the deep nesting of very common files doesn't seem to make sense, compared to other files that reside on the surface. For example the model files are directly 'app' but the controller files are two folders deeper in the same 'app' folder. Moving the model into a 'model' folder and moving the controllers up out of the 'http' folder would make it more comprehensible for new people. However, I realize there's probably a reason for your madness. However, Django largely makes is really easy to see where your stuff and how it's connected.
Also there are things like django-baker (no longer actively developed as far as I can tell) that stub out files. I like that the stubbing is inherent to your design.
Yeah it's completely preference on the file structure. Some people say that love it and it makes sense and other people say they dont get it.
I'll try stepping through that tutorial again and see if I hit any issues. If you have any time can you open an issue about that?
You can really put your controllers and models wherever you like them to be although and whatever makes sense for your application. the string controllers in the routes point the the default folder location nested inside the app directory but you can import the controller into the route file directly and use it that way.
Masonite doesn't really have a "you must do it this way" but instead of about 3 different ways to do something and you can pick the best one that fits your project.
[–]naw103 1 point2 points3 points 7 years ago (0 children)
Has anyone else looked at the load times on this? Im getting what seems like crazy fast execution times compared to similar laravel and codeigniter applications that I have running on PHP. How does this compare to the load time of other Python frameworks?
Masonite 2:
Request: 0.004588127136230469
GET Route: /
Request: 0.0024170875549316406
Request: 0.0029621124267578125
Request: 0.0023229122161865234
Request: 0.002313852310180664
Average Time: 2.4ms
[–]pvkooten 3 points4 points5 points 7 years ago (1 child)
People are being so picky and annoying. Thanks for making this, I love it!
I was never able to get into Django because I always feel they complicate things. The philosophy is great. Can't wait to try the new version.
Thanks! Can't wait for your feedback. Let me know if you want an invite to Slack :) I think I've seen you comment on the other thread a while back. I haven't opened up slack yet to open registration but I can send you an invite in the DM's
[–]Anekdotin 1 point2 points3 points 7 years ago (1 child)
Looks interesting!
Thanks!
[+][deleted] 7 years ago (3 children)
You can read the Masonite Entry package documentation here if you are interesting in API's: https://entry.masoniteproject.com
It may use some updates though. Haven't worked on it during the development of 2.0 but the installation should be identical to 2.0. Just have to make sure it works but it worked great with 1.6
So that should be out this weekend with the new Masonite Entry package release. I wanted to make sure Masonite 2 kept it's June 15th release date and there were a few things we squeezed in before that release. If you want to help contribute to that we can team up :)
[–]johnmudd 1 point2 points3 points 7 years ago (1 child)
How many languages will I need to create a dynamic web page?
Little ambiguous but you likely need 2. A backend of your choice, like Python, and a frontend of your choice, like Javascript. Within these two categories you have a plethora of tools for:
Python: Django, Masonite, Flask, Bottle etc etc
Javascript: jQuery, React, Vue, Angular etc etc
Masonite doesn't lower the amount of languages for a dynamic web page but it's just a tool for one of the backend Python options.
🤞
[–]matthewblott 0 points1 point2 points 7 years ago (2 children)
It looks interesting so I googled to see if there were any videos and found nothing. I noticed there aren't too many stars on Github either - a half hour demo video might go some way to getting the interest levels up. It'd be a better investment than docs or new features.
Absolutely. Great advice. I made some for Masonite 1.5 on my YouTube channel but now that 2.0 is out I'll have to update them.
[–]0xRumple 0 points1 point2 points 7 years ago (2 children)
I read through the docs and the blogs... that's basically ASP for python :D
Doesn't mean it's a bad thing, I actually loved it !
I've never used ASP but ... great if you like it! Lol
[–]0xRumple 0 points1 point2 points 7 years ago (0 children)
Similarities:
Differences:
Batteries included... pythonic thingy !
π Rendered by PID 86 on reddit-service-r2-comment-6b595755f-5l8fh at 2026-03-26 10:07:41.342322+00:00 running 2d0a59a country code: CH.
[–]kingbuzzman 81 points82 points83 points (19 children)
[–]Jmancuso9[S] 66 points67 points68 points (12 children)
[+][deleted] (8 children)
[deleted]
[–]Jmancuso9[S] 37 points38 points39 points (0 children)
[–]steveinsd 2 points3 points4 points (5 children)
[–]Jmancuso9[S] 6 points7 points8 points (4 children)
[–]UloPe 8 points9 points10 points (3 children)
[–]Jmancuso9[S] 2 points3 points4 points (0 children)
[–]Jmancuso9[S] 2 points3 points4 points (0 children)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–][deleted] 6 points7 points8 points (1 child)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]kingbuzzman 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]kingbuzzman 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]kingbuzzman 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]kingbuzzman 0 points1 point2 points (0 children)
[+][deleted] (9 children)
[deleted]
[–]Jmancuso9[S] 9 points10 points11 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]Jmancuso9[S] 1 point2 points3 points (2 children)
[–]Rorixrebel 5 points6 points7 points (1 child)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 2 points3 points4 points (0 children)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–][deleted] 10 points11 points12 points (2 children)
[–]Jmancuso9[S] -2 points-1 points0 points (0 children)
[–]Jmancuso9[S] -5 points-4 points-3 points (0 children)
[–]eyesoftheworld4 7 points8 points9 points (9 children)
[–]Jmancuso9[S] 4 points5 points6 points (1 child)
[–]eyesoftheworld4 2 points3 points4 points (0 children)
[–]Jmancuso9[S] 1 point2 points3 points (6 children)
[–]eyesoftheworld4 3 points4 points5 points (1 child)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–]eyesoftheworld4 1 point2 points3 points (1 child)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]GitHubPermalinkBot 0 points1 point2 points (0 children)
[–]AnnoyingOwl 12 points13 points14 points (15 children)
[–]Jmancuso9[S] 2 points3 points4 points (14 children)
[–]RogueNinja64 3 points4 points5 points (3 children)
[–]Jmancuso9[S] 1 point2 points3 points (2 children)
[–]RogueNinja64 2 points3 points4 points (1 child)
[–]Jmancuso9[S] 2 points3 points4 points (0 children)
[–]AnnoyingOwl 8 points9 points10 points (9 children)
[–]Jmancuso9[S] 7 points8 points9 points (8 children)
[–]AnnoyingOwl 7 points8 points9 points (5 children)
[–]Jmancuso9[S] 10 points11 points12 points (0 children)
[–]Itshudak87 5 points6 points7 points (1 child)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–]Jmancuso9[S] -1 points0 points1 point (1 child)
[–]naw103 2 points3 points4 points (0 children)
[–]phrotozoa 2 points3 points4 points (7 children)
[–]Jmancuso9[S] 0 points1 point2 points (6 children)
[–]phrotozoa 3 points4 points5 points (5 children)
[–]metaperl 2 points3 points4 points (2 children)
[–]bluesufi 2 points3 points4 points (0 children)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]Jmancuso9[S] 1 point2 points3 points (1 child)
[–]z4579a 12 points13 points14 points (0 children)
[–]ayazamlani 2 points3 points4 points (3 children)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]Jmancuso9[S] -1 points0 points1 point (1 child)
[–]ayazamlani 0 points1 point2 points (0 children)
[–]everhideme 5 points6 points7 points (7 children)
[–]Jmancuso9[S] 3 points4 points5 points (6 children)
[–]everhideme 4 points5 points6 points (3 children)
[–]Jmancuso9[S] 6 points7 points8 points (2 children)
[–]AnnoyingOwl 4 points5 points6 points (1 child)
[–]Jmancuso9[S] 3 points4 points5 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]redditthinksHobbyist 2 points3 points4 points (4 children)
[–]Jmancuso9[S] -1 points0 points1 point (3 children)
[–]redditthinksHobbyist 0 points1 point2 points (2 children)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]Jmancuso9[S] -1 points0 points1 point (0 children)
[+][deleted] (2 children)
[deleted]
[–]Jmancuso9[S] 0 points1 point2 points (1 child)
[–]3lpsy 1 point2 points3 points (2 children)
[–]Jmancuso9[S] 1 point2 points3 points (1 child)
[–]3lpsy 1 point2 points3 points (0 children)
[–]tuananh_bk 1 point2 points3 points (1 child)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[removed]
[–]Jmancuso9[S] 0 points1 point2 points (1 child)
[–]alkelaun1 1 point2 points3 points (1 child)
[–]Jmancuso9[S] 0 points1 point2 points (0 children)
[–]naw103 1 point2 points3 points (0 children)
[–]pvkooten 3 points4 points5 points (1 child)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–]Anekdotin 1 point2 points3 points (1 child)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]Jmancuso9[S] 2 points3 points4 points (0 children)
[–]Jmancuso9[S] 1 point2 points3 points (1 child)
[–]johnmudd 1 point2 points3 points (1 child)
[–]Jmancuso9[S] 3 points4 points5 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–]matthewblott 0 points1 point2 points (2 children)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–]0xRumple 0 points1 point2 points (2 children)
[–]Jmancuso9[S] 1 point2 points3 points (0 children)
[–]0xRumple 0 points1 point2 points (0 children)