any open source website & demo power by sanic?
it would be nice to have examples project in README.md
https://github.com/HackerDom/ructfe-2016/tree/master/services/atlablog -- It is web-service based on sonic. It was developed for hacker competitions. It my be helpful for education purposes.
Entry -- https://github.com/HackerDom/ructfe-2016/blob/master/services/atlablog/entries/models.py#L19-L25Entry uses for store in DB BlogPosts, Comments and FIleAttachments.
The key point here: https://github.com/HackerDom/ructfe-2016/blob/master/services/atlablog/main.py#L89-L91
(example of reusable Blueprint for storing Entry model in different DB tables)
http://securitynode.com Internal APIs are powered by sanic. Public API will be released soon as this site is currently under development. DISCLAIMER: I am the developer/owner of the site.
it seen like flask, can it use flask plugin add on?
@decemer No unfortunately while sanic may seem similar to flask in it's outward facing api, it's internals are very different, leading to incompatibility with flask plugin add ons.
We use sanic in our event push notification because of it's speed. And there's no UI so I can't showcase it.
I wrote a PasteBin clone a while ago, as a Flask demo project. I might make a Sanic fork of it if there is interest, but I could use some seasoned feedback in it, given that I have not used Sanic and asyncio extensively and will probably result in some bad usage practices.
Edit: I just finished the bulk of the refactoring, you can see it here. It's currently broken for reasons I am currently too sleep deprived to figure out why (for some reason Sanic is not reading the contents of the form and says it didn't receive any).
If this turns out better than it's Flask counterpart I might just host it under http://api.cbeam.io/ where the flask version currently lies (or have them running side by side), thus fulfilling the motif of having an open-source website operating with Sanic.
Sidenote: There is still no front end in that domain, so you'll have to do requests from the command line.
Luizberti, the link http://api.cbeam.io/ is wrong or broken and browser get 404.
@KeyJoo as I mentioned in the sidenote, there is no front end on it (yet).
You can go to http://api.cbeam.io/ping to see that the Flask app is really running.
And if you have httpie installed you can use it like:
http --form POST api.cbeam.io/submit Accept:text/plain content='something'
http GET cpi.cbeam.io/<pasteid> Accept:text/plain
I just finished rewriting the Flask demo in Sanic's lingo. The benchmarks against the old version are insane, beat Flask+Gunicorn by a whopping margin (did 760k requests in the same amount of time Flask took to do 16k on a single core). I have a feeling that if I switched to aioredis too performance would go bonkers, but this is good enough for now.
The whole thing is done in roughly 80 tidy lines of code and it reads nicely. Right now it's up and running at http://api.cbeam.io/ and it has replaced the Flask version entirely. I would like some feedback on it if anyone would care to take a look, if you can think of any other use cases I could add that exemplify other features of Sanic feel free to open an issue in the tracker.
Hopefully this can help newcomers get goin' faster faster 馃槃
FYI, I've tried this as well, and aioredis murders my performance. I have one system that does event logging to disk that runs Sanic, and it has insane performance. I tried porting my API gateway to Sanic, and it's terrible - almost all because of aioredis.
I posted a question about this to the uvloop GitHub (https://github.com/MagicStack/uvloop/issues/73), and they basically said the structure of aioredis will kill performance. I also considered aredis (https://github.com/NoneGG/aredis), but their benchmarks show the same thing.
Having said all of that, if you can make this work at a level above Flask, that would be awesome. Just letting you know that it might be out of your control without rewriting aioredis.
Another example:
https://github.com/stopspazzing/Sanic-Server-with-MDL-Blog-Template
can we close this or: https://github.com/channelcat/sanic/issues/396 ?
No need for both
Closed in favor of #396
Most helpful comment
Update on the Demo Project
I just finished rewriting the Flask demo in Sanic's lingo. The benchmarks against the old version are insane, beat Flask+Gunicorn by a whopping margin (did 760k requests in the same amount of time Flask took to do 16k on a single core). I have a feeling that if I switched to
aioredistoo performance would go bonkers, but this is good enough for now.The whole thing is done in roughly 80 tidy lines of code and it reads nicely. Right now it's up and running at http://api.cbeam.io/ and it has replaced the Flask version entirely. I would like some feedback on it if anyone would care to take a look, if you can think of any other use cases I could add that exemplify other features of Sanic feel free to open an issue in the tracker.
Hopefully this can help newcomers get goin' faster faster 馃槃
link: https://github.com/luizberti/codebeam-api