3 ms·
I read in an answer of yours that you're learning Python. I learned Ruby myself with Rails in 2005 because I had no other reason to use Ruby back then. Rails wa
by pmontra 10y ago
I read in an answer of yours that you're learning Python. I learned Ruby myself with Rails in 2005 because I had no other reason to use Ruby back then. Rails was a much lighter framework than Django is now. I would recommend to start with something very lightweight, get the gist of it and move on to Web2py or Django.
What you're looking for could be Flask or even something simpler like
https://docs.python.org/2/library/simplehttpserver.html https://docs.python.org/2/library/simplehttpserver.html
or its Python3 version
https://docs.python.org/3/library/http.server.html https://docs.python.org/3/library/http.server.html
Now, about Django...
I inherited a Django project and after a few months working on it I wouldn't start a project of mine with it. Obviously customers can ask me to do anything :-)
Disclaimer: I might be biased against it because I don't like Python much (it looks like a badly engineered Ruby, and probably the other way around if you like Python, no bad feelings).
First problem: coming from 10 years of Rails, Django is very weakly opinionated, so you can arrange the project as you want, name the db fields as you want, etc. This is not as bad as having no framework or using Flask, but a developer joining a project might have to spend time to get familiar with the general structure of it (and the bill for the customer keeps growing, so the chances he won't be happy).
Second problem: it doesn't import automatically every model and module. It gets tiresome to do that in every file and in the shell (and the bill...) This is not a language thing because Ruby has to import modules too but somewhat Rails works around that. Surprisingly it raised problems for me only a couple of times. The sum of the time lost with Python in the last few months is greater than the one I lost in Rails because of that.
Third: the templating language is not Python but some crippled down language. Somewhat people still manage to write nice code with Web2py which uses full Python in the templates. Rails too. Why not Django? More time lost to learn one more thing.
Web2py is an alternative but it has its share of problems: the first two of Django plus a very risky approach at migrations which are automatically enforced as soon as you run the code. If there is a way to turn that off and you really like Python or have to work with it, look at Web2py.
About the nice points, it's got everything that it has to be taken for granted in a past 2005 web framework: tests, migrations, ORM. It doesn't miss any particular feature, it's got a big community so it's a safe choice and I won't steer customers away from it.
- pythonaut_16 10y agoThose are all intentional choices and benefits of Python 1. This gives you flexibility to structure your app in a way that makes sense for what you're doing. In addition, I've found Django's approach to modular apps to be far more manageable and approachable than Ruby's "all the controllers go in the controllers folder" approach. 2. Explicit imports is a Python thing and a huge benefit. I've looked at plenty of Rails code bases where I had no idea where different functions and variables were coming from. In Python/Django, you can always see the explicit definition at the top of the file. 3. The "crippled down" templating language is very intentional as well. Django is preventing you from writing your application in the templating logic (something I've seen too much of in Rails) All your template should be doing is specifying how the data is to be rendered in HTML/whatever. Really Python/Django could be said to be Ruby/Rails flipped on it's head. Ruby itself isn't very opinionated (there are usually several ways to do something), while Rails is. Python itself is pretty opinionated (there should be one right way to do things), while Django isn't. In general it's a matter of opinion and perspective but I personal find Python and Django to be much easier to work with than Ruby and Rails.
- tim333 10y ago>migrations which are automatically enforced as soon as you run the code. If there is a way to turn that off... You can do "db = DAL(..., migrate_enabled=False)" I believe.