by

## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Mar 14 19:42
florimondmanca closed #334
• Mar 14 19:41
florimondmanca commented #334
• Mar 14 19:39

florimondmanca on pip

• Mar 14 19:39
dependabot-preview[bot] commented #342
• Mar 14 19:39
florimondmanca closed #342
• Mar 14 02:00

dependabot[bot] on npm_and_yarn

• Mar 14 02:00
dependabot[bot] commented #343
• Mar 14 02:00
florimondmanca closed #343
• Mar 13 23:34
codecov-io commented #343
• Mar 13 23:33
codecov-io commented #343
• Mar 13 23:32
codecov-io commented #343
• Mar 13 23:29
dependabot[bot] labeled #343
• Mar 13 23:29
dependabot[bot] opened #343
• Mar 13 23:29

dependabot[bot] on npm_and_yarn

Bump acorn from 6.1.1 to 6.4.1 … (compare)

• Mar 09 05:28
codecov-io commented #342
• Mar 09 05:28
florimondmanca commented #342
• Mar 09 05:27
codecov-io commented #342
• Mar 09 05:26
codecov-io commented #342
• Mar 09 05:23
dependabot-preview[bot] labeled #342
• Mar 09 05:23
dependabot-preview[bot] opened #342
Ilyes Bouchlaghem
@Ibouch
but it did not make sense
Florimond Manca
@florimondmanca
Oh, right. Yeah, Bocadillo has nothing to do with this paper. 😅 I can see that’s what I get as a second result when googling for “asynchronous salsa” as well.
Ilyes Bouchlaghem
@Ibouch
I chose to use starlette.io, but I may reconsider my choice if I realize that bocadillo saves me development time and does not affect performance. This is for a web application of a large community and the current version under Flask (and Flask-SocketIO for websocket), does not support the load.
If I use bocadillo, I will mention to my community (video games so also some devs) to increase the visibility of your project!
Florimond Manca
@florimondmanca
Sounds good! Good luck with your project 👍
Ilyes Bouchlaghem
@Ibouch
Thank you :)
EricE
@EricE
I'm wondering is something is off with the demo file structure? I ran bocadillo create demo and got
+---demo
¦   +---demo
¦   ¦   +---app.py
¦   ¦   +---asgi.py
¦   ¦   +---providerconf.py
¦   ¦   +---settings.py
¦   ¦   +---__init__.py
¦   +---templates
(I added templates). From the tutorial it seems like templates should be in the same subdirectory as app.py but jinja2 throws an error if it is
I run uvicorn demo.asgi:app --reload in the first demo subdirectory
EricE
@EricE
If I run uvicorn asgi:app --reload in the second demo subdirectory, it errors:
(D:\SVNRepo\projects-sw\async_web\trunk\env) D:\SVNRepo\projects-sw\async_web\tr
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Process SpawnProcess-1:
Traceback (most recent call last):
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\multiprocessing\process.p
y", line 297, in _bootstrap
self.run()
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\multiprocessing\process.p
y", line 99, in run
self._target(*self._args, **self._kwargs)
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\mai
n.py", line 305, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\asyncio\base_events.py",
line 584, in run_until_complete
return future.result()
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\mai
n.py", line 312, in serve
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\con
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\imp
orter.py", line 23, in import_from_string
raise exc from None
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\imp
orter.py", line 20, in import_from_string
module = importlib.import_module(module_str)
File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\importlib\__init__.py", l
ine 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File ".\asgi.py", line 3, in <module>
from .app import app
ImportError: attempted relative import with no known parent package
INFO: Stopping reloader process [18712]
Florimond Manca
@florimondmanca

From the tutorial it seems like templates should be in the same subdirectory as app.py but jinja2 throws an error if it is

The docs say that it should be placed in the same directory relative to where the app is run (ie using uvicorn), so that means the location you put it at should work. Doesn’t it?

If I run uvicorn asgi:app --reload in the second demo subdirectory, it errors:

Yes, that is expected, because the generated demo package uses relative imports, which you can’t use in Python unless you’re running from outside of that package. We should probably add a warning/caveat in the docs

EricE
@EricE
It did work when I put the templates directory as I showed in the directory tree listing above. However, in the templates guide it looks different:
shows the templates directory at the same level as app.py. However, app.py is created in the second demo subdirectory and when I tried running there it caused the above error. So I was able to make it work but it seems inconsistent with the documentation.
EricE
@EricE
Florimond Manca
@florimondmanca
Yes, I see. This is because the example app there doesn’t use a project generated with Bocadillo CLI. The templates dir location really is irrelevant or where app.py is. It really is just ./templates, with . meaning the current directory.
Could you track this in an issue, please? I’ll have a look when I have some time. Or if you feel like it you can propose a clearer wording. :-)
Florimond Manca
@florimondmanca
@EricE I opened #276 :+1:
Zuhair
@florimondmanca
Florimond Manca
@florimondmanca
Hi @zowhair_twitter :-) DB support is not built-in, but you should find useful info here: https://bocadilloproject.github.io/discussions/databases.html
Zuhair
Thanks bro, and cli tool you used is click??
Florimond Manca
@florimondmanca
Yup, Bocadillo CLI is built on top of Click
Zuhair
i see..
Florimond Manca
@florimondmanca

Hi peeps, just to let you know that I am planning to close this Gitter chat soon.

The experience I’ve had is that most of the discussions taking place here would benefit from being out there in the open (ie in GitHub issues), indexed, searchable and actionable.

Also, while I enjoy answering questions, the chat or DM system here has been taking up on my attention, and it would be much easier to manage via issues.

So I invite everyone to start using issues for questions (even simple ones!), since this chat should be closed by next week. 👍 Thanks!

Marwan Rabbâa
@waghanza
Hi, could a route be constrained (accept only digits for example) by any regexp or else ?
Florimond Manca
@florimondmanca
Hi @waghanza, I don’t think regex validation is supported atm. I think it’s an interesting topic though, could you open an issue as I mentioned in my last post?
Also realizing that I didn’t actually close this chat 😄 actually my thought is that Gitter may not be the best solution for community gathering and chatter. Haven’t got much time to dedicate to this recently unfortunately. Will open an issue to track what’s to be done / what questions need to be discussed
Marwan Rabbâa
@waghanza
@florimondmanca perhaps slack could be a suitable alternative
Florimond Manca
@florimondmanca
Yes, I’ve been thinking about Slack — I know a few communities that use it (Masonite, Tartiflette), but the fact that workspaces are private bugs me (not searchable, not indexable, etc). I’ve also heard about Spectrum, do you know about it / have any opinion on it? :)
Marwan Rabbâa
@waghanza
have heard of it, but now used. I like slack because of ecosystem + mobile app, and I've also heard of https://twist.com which is a slack alternative
I'm not keen on discord
EricE
@EricE
Greetings, I couldn't bring myself to post this as an issue :) I chatted with you previously about using Bocadillo to create a site that would replace a desktop app. I need to do hundreds/thousands of REST queries, database accesses, crunch numbers and generate various UIs. As you might recall I am a hardware guy and still learning web dev stuff. It seems like a lot of the async web frameworks are oriented towards being a site that responds to API requests vs being a consumer of them? Does this sound like an appropriate use of Starlette or should I just stay with something like Flask and Celery?
Florimond Manca
@florimondmanca
Hey @EricE! Sure, let’s chat here. :) Oh and for anyone concerned Bocadillo just entered unmaintained state - as announced at the beginning of October eg in #334.
So, if your use case is to make HTTP requests rather than respond to them, it seems you’re looking for an HTTP client rather than a web framework (which help at building servers).
If that’s the case you might be interested in checking our HTTPX: https://github.com/encode/httpx, which is basically a more modern version of Requests, in particular with async support.
My guess is you can use HTTPX to make API calls, a library like databases (https://github.com/encode/databases) for async database access, and if you need to serve some web pages on top then you can definitely look into Starlette
EricE
@EricE
Thanks @florimondmanca, I do want the user interface to be web based which is why I was looking at Bocadillo/Starlette and I was already using httpx to make the requests. So it sounds like I should stay in the ASGI world with Starlette (and probably Vue) with httpx and databases to give me a web based version of what I was doing on the desktop (which was pretty ugly). This is a personal project for me and the electrical engineers I work with have no idea what I'm talking about with this stuff so I appreciate you taking the time to respond.
And congrats on your work with httpx, I've been watching it for a number of months and I see you're now the #2 contributor.
Florimond Manca
@florimondmanca

Yep, I think you’ve got a pretty reasonable tech stack then :) If you’re looking for inspiration Tom is building an example Starlette web app with templates + databases + Heroku deployment and what not. It’s grown in size but I think going up the PR history could turn out interesting in terms of « how to setup X » in the context of a Starlette project: https://github.com/encode/hostedapi

the electrical engineers I work with have no idea what I'm talking about with this stuff

Nice! 😂

EricE
@EricE