Page 2 of 3
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Fri Nov 22, 2019 3:11 pm
by Hyperion
dhylands wrote: ↑Wed Nov 20, 2019 3:36 pm
WHen I used it, I hd to make sure it was used as a frozen module.
Never done freezing before but always wanted to learn it. How do you freeze the whole folder though? Do I just have to put the whole folder into the modules directory before building?
Edit: Figured it out, server now started and I still have over 100kB of memory left
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Wed Nov 27, 2019 10:23 am
by devnull
Cant run this on SF6:
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "MicroWebSrv2/microWebSrv2.py", line 221, in StartManaged
File "MicroWebSrv2/microWebSrv2.py", line 213, in StartManaged
File "MicroWebSrv2/microWebSrv2.py", line 184, in StartInPool
MicroWebSrv2Exception: Not enough memory to allocate slots.
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Fri Dec 06, 2019 1:05 pm
by Hyperion
How does sending response by a data stream work? I need to send a large file stored in another module back to a client, but I can read it through UART only by smaller chunks due to low available memory in the MPY board, so I think streaming it is my only option. I would like to send a packet after receiving 1024 bits through UART (stored in a bytearray), and only after the last packet is sent, I need to send the 200 OK response code.
The ReturnStream method needs to send a code so will it send only the first 1024-bit packet? How does it know to wait for another one? Btw I know the number of bits the file will have, before the UART transmission starts, if that helps.
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Fri Dec 13, 2019 6:37 pm
by rubenafonso
Hyperion wrote: ↑Fri Nov 22, 2019 3:11 pm
Edit: Figured it out, server now started and I still have over 100kB of memory left
Hi,
I have the same memory problem when try to run it on ESP32. @Hyperion, can you tell what you did to overcome this problem? Did you use the frozen?
Thanks in advance.
Regards,
Ruben
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Tue Dec 17, 2019 3:53 pm
by Hyperion
rubenafonso wrote: ↑Fri Dec 13, 2019 6:37 pm
Hi,
I have the same memory problem when try to run it on ESP32. @Hyperion, can you tell what you did to overcome this problem? Did you use the frozen?
Thanks in advance.
Regards,
Ruben
Hi, yeah I froze the whole module. Just look for tutorials on how to freeze a module, there are a plenty (I can't find the one I used last time, sorry). Let me know if you need any help!
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Tue Dec 17, 2019 9:07 pm
by Hyperion
Any convenient way to enable gzip compression for sending .gz files and non-zipped files only if the .gz files aren't found in the specified directory? I'm getting 404 on all requests for files that are present only as .gz
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Wed Dec 18, 2019 12:11 pm
by rubenafonso
Hyperion wrote: ↑Tue Dec 17, 2019 3:53 pm
Hi, yeah I froze the whole module. Just look for tutorials on how to freeze a module, there are a plenty (I can't find the one I used last time, sorry). Let me know if you need any help!
Hi,
Thanks for your help! I was able to run the server with the frozen the module!
I followed the example of these links:
https://learn.adafruit.com/micropython- ... en-modules
The dependencies are the MicoPython source (
https://github.com/micropython/micropyt ... orts/esp32) and the ESP32 toolchain (
https://docs.espressif.com/projects/esp ... setup.html).
I hope this could help others in the future.
Best regards,
Ruben Afonso.
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Mon Feb 17, 2020 9:22 pm
by seonr
I just started using this in a project - thanks heaps for making it jczic!
I'm trying to use a pyhtml file as a default page, but it's giving me a [403: forbidden] whenever it tries to serve it.
I have the PyhtmlTemplate module loaded and I'm adding the file as a default page before I start the server, but I can't get it to work.
Other non .pythml files are working as expected.
Is this supported?
Thanks,
Seon
Unexpected Maker
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Tue Feb 18, 2020 2:29 am
by seonr
Ok, I just found this issue:
https://github.com/jczic/MicroWebSrv2/issues/22
It states .pyhtml files are not processed for default pages. That's a real shame. I get I can manage the '/' route and do a redirect to it, but that's another slow page change running on a microcontroller.
Is there a specific reason it's not loaded before so it can be used on default pages? Is it a memory or performance constraint?
Thanks,
Seon
Unexpected Maker
Re: MicroWebSrv2, new asynchronous Web server for MicroPython (+Routes +WebSockets +Template engine).
Posted: Wed Mar 04, 2020 3:00 pm
by ChrisB
Hi,
I am new to µPython and ESP32.
I tried to use MicroWebSrv2 but I get this error :
File "main.py", line 145, in <module>
File "MicroWebSrv2/microWebSrv2.py", line 136, in LoadModule
MicroWebSrv2Exception: Cannot load module "PyhtmlTemplate".
I am using uPyCraft and I can see the file in the mods directory.
I have no idea why it's not able to load it?
Thanks for your help
Chris