Comments (5)
BTW I'm relatively new to asyncio but have used microdot successfully before
from microdot.
Apologies, it isn't render_template that is hanging it is the return of the template. I put some print statements around the render_template and it is working fine. I needed to make the function after the @route an async.
@app.route('/')
async def index(req):
I don't really uderstand why, but suspect this is my lack of understanding of async. Happy to close if my thought is correct
from microdot.
@Odud: Ah, okay, I do see what the problem is now. In MicroPython async functions are really generators. The render_template()
function returns a generator as well. Microdot is confused because a non-async function is returning something that looks like what an async function would return. I need to find a way to distinguish the return value of calling an async function from a generator returned by a non-async function, which actually look the same.
In the meantime your solution is fine, just make sure any functions that use render_template()
are defined as async functions. I'll investigate to see if I can figure out how to make non-async functions work as well.
from microdot.
from microdot.
Related Issues (20)
- Create a "mini" Microdot with reduced features HOT 4
- WebSocket error (and disconnect ws client) when connected via AP and STA mode. HOT 5
- Error when making requests from a Micropython client to a Microdot server HOT 3
- Crashing when using öäü special chars in html input as form HOT 3
- WebSocket becomes unresponsive for slow sensors
- Int type in a url pattern does not handle negative numbers HOT 2
- No longer working on ESP8266 HOT 1
- "Generator raised StopIteration" error when sending static file from filesystem HOT 1
- When using asgi adapter, all header names and values are returned as binary instead of strings
- Network loss event handling HOT 1
- On ESP32: Out of memory with quite a basic setup? HOT 4
- BUG: ValueError: need more than 1 values to unpack HOT 1
- Memory Error in a basic hello world setup HOT 1
- UTF-8 decode error HOT 5
- Document access to ASGI scope
- Calling shutdown() throws error when there was no request made (using async WebSockets) HOT 8
- Please provide a port to CircuitPython HOT 2
- WebSocket die and after a time HTTP die as well HOT 4
- Microdot + ssl socket connection HOT 30
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microdot.