[QUESTION][BOTTLE][FLASK][DJANGO] About web frameworks and SD
-
Hello:
Actually, I just bought a new pycom board and i wonder if it is possible to:
1)Use web frameworks like Django (https://github.com/django/django/tree/master/django/db/models), flask (https://github.com/pallets/flask/tree/master/flask) or bottle (https://github.com/bottlepy/bottle), considering the last one is just one .py file, in order to create a simple web server?
-
If i bought an expansion board with a micro SD... Can i store in said SD card .python files, javascript files or html in order to be imported to the board?
-
Its possible to install some database inside a SD card in order to be used for the board?
Thank you
-
-
You can try something like this: https://github.com/jczic/MicroWebSrv looks like the author explicitly supports pycom modules.
(Please note this isnt an official pycom recommendation. I've never used it. we dont support the library. I just found it in my travels and thought it might be usefull)
@jczic if you happen to stumble across this. Good work. Look's like a neat project!
-
@nervencid You can set up aserver on the board. There is nothing that stops you to do so. Only you cannot expect that code that is intended for a windows or linux based machine will work. These are Micro's and MicroPython, and so you need a Micro Server.
-
Hello @robert-hh and thank you for your response:
So, apart of that two frameworks is it impossible to set up a server on the board?
-
@nervencid No. If you look at the code of bottle, there are about a dozen libs which are imported by bottle which do not exist in Micropython. And there exists no run-time environment like the one assumed by the code,
-
@robert-hh nervencid less than a minute ago
Hello and thank you for your answer:
By "None of them will work without major rework", you mean that at least bottle would work fine on the board?
Thank you
-
This post is deleted!
-
@nervencid Some notes:
ad 1) None of them will work without major rework. These applications are made for a machine with full OS and full Python implementation. But there are a few Micro web servers around which you can use, like this one: https://github.com/jczic/MicroWebSrv in combination with https://github.com/jczic/MicroDNSSrv.
ad 2) Micropython allows the usual file access methods to the SD. You can run python scripts from the SD and use that for data.
ad 3) Yes. If you have a database script, it can use the SD. Unlike the micropython.org branch, the Pycom branch does not include a database module by default.