Django 1.8 and Python 3: Complex app tutorial, end-to-end
marinamele.com
marinamele.com
At the moment I'm working on building an app in Node.js with Express and sadly, there are not many tutorials of this quality.
[1]: https://github.com/mineta/taskbuster-boilerplate/blob/master...
[2]: https://github.com/mineta/taskbuster-boilerplate/blob/master...
https://docs.djangoproject.com/en/1.8/releases/1.8/#template...
https://docs.djangoproject.com/en/1.8/releases/1.8/#django-c...
Alternative is to use something like Celery: http://docs.celeryproject.org/en/latest/index.html
The main issues when you start to have a stack built of big independant systems ( such as a db, a message queue, worker processes, and web server) are more related to deployment, monitoring and failover management. But they are really the big issues that justify the choice of a technology instead of another.
As an example - I use this to create contracts with LaTeX asynchronously. The contract is created and then sent to the user by email. A management command runs every 5 minutes to check if there are any contracts that need to be generated.
- Java / Scala / Clojure
- Go
- Erlang (add Elixir if you are comfortable with its maturity)
Not meant to be an exhaustive list of languages. Celery is great but there are plenty of situations where chucking units of work into a job queue or running a cron job feels like an incomplete solution.For something more similar to Go/Java/Scala/Clojure/whatever, you can use Python's gevent or asyncio.
as for the other persons answering me: i'm not only talking about long request. think about something like scheduling emailings or reports or ios notification , periodically or based on some db state change.
not something you'd want to handle with just an async framework.
i suppose celery is, on the paper, comparable in terms of fearures, yet the one time i had to use it made me feel like playing with a brittle toy, and in the end, i had to use a "recycle on every jobs" setting to prevent memory leaks from crashing everything. not that i believe celery is leaking memory, but that tying all the pieces together is a real pita.
You could simply use this: if all you need is to run a slow task and not block a request there's this: https://github.com/defrex/django-after-response
I've usually used the system crontab (sometimes via https://github.com/andybak/django-cron ).
If you really really need a proper task queue then Huey is much lighter than Celery: https://huey.readthedocs.org/en/latest/
If you do need something more than
The hendrix project - and its crosstown_traffic API specifically, is designed to alleviate this pain and remind that python (well, Twisted) is absolutely an enterprise-ready asynchronous network solution.
Say what?
The suckiness of celery doesn't come from its use of python. I'd be interested to know how you consider python not to be "enterprise ready".
We've been running it 4 years in production with no problems. It's really a nicely performant option with nice fail over options, and great debugging.
|-manage.py |-MyApp/ |---- settings.py, urls.py, wsgi.py,... etc. |-AnotherApp1 |---- urls.py, models.py, views.py, migrations/... etc. |-AnotherApp2 |---- urls.py, models.py, views.py, migrations/... etc.
This might make it not-that-suitable for actually complex projects.
EDIT: ah, looks like the formatting here did't support what I tried to do...
|-manage.py
|-MyApp/
|---- settings.py, urls.py, wsgi.py,... etc.
|-AnotherApp1
|---- urls.py, models.py, views.py, migrations/... etc.
|-AnotherApp2
|---- urls.py, models.py, views.py, migrations/..I'd think that `AnotherApp{1,2}` would be subdirectories of `MyApp/`, right?