Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: kmhill on March 08, 2019, 08:21:32 AM

Title: Regarding Python flask
Post by: kmhill on March 08, 2019, 08:21:32 AM
Hello folks;

I have an interest in Python flask, which is a lightweight framework for web applications. I've dabbled with flask on Windows, Ubuntu, an Android tablet, as well as Raspbian. Now I'm trying to get my head around the idea of how to run flask on Tiny Core.

The standard install appears to make use of pip, virtual-environment for Python 2.7, and build tools. Any ideas, guidance, or comments will be appreciated.
Title: Re: Regarding Python flask
Post by: kmhill on March 09, 2019, 08:57:54 PM
Hello folks, I started out somewhat distracted. The tutorials for Flask I've reviewed suggested using pip to install and to use a "virtual Python environment" to avoid library conflicts. All that's convenient for a PC having a persistent file system.

To get back on track, I've downloaded the source for flask v1.0.2, unpacked that, and loaded the following TC extensions:
Inside there is a setup.py for managing the build. Of course, the install is temporary, until the system is shutdown.

  $ python setup.py build
  $ sudo python setup.py install

I'm experimenting. Having dillo installed is convenient. I've been able to run a hello-world example that I found in a tutorial, which is reassuring. This is a start.


Title: Re: Regarding Python flask
Post by: Rich on March 09, 2019, 09:11:15 PM
Hi kmhill
Quote
... Of course, the install is temporary, until the system is shutdown. ...
Maybe you can adapt the create a file to use as a timestamp and the  find -newer  commands to gather the files into an extension:
http://wiki.tinycorelinux.net/wiki:creating_extensions#when_destdir_fails
Title: Re: Regarding Python flask
Post by: Juanito on March 11, 2019, 12:08:27 AM
You might be able to do something like this:
Code: [Select]
sudo python3.6 setup.py install --root=/tmp/pkg
..after removing pycache files, *.pyc and *.pyo, you can then create an extension with:
Code: [Select]
$ cd /tmp
$ sudo mksquashfs pkg/ python_something.tcz
$ sudo chown tc:staff *.tcz
$ md5sum python_something.tcz > python_something.tcz.md5.txt
$ unsquashfs -ll -d '' python_something.tcz | grep -v '^d' | sed -e 's#.* /#/#' -e 's# -> .*##' -e 1,3d > python_something.tcz.list
Title: Re: Regarding Python flask
Post by: kmhill on March 11, 2019, 09:17:29 PM
Thanks fellows for the tips, I'll give them a try.
Title: Re: Regarding Python flask
Post by: kmhill on March 13, 2019, 08:18:53 AM
Please, I'm curious about the step, to remove pycache, *.pyc and *.pyo files. Would having those files around introduce a dependency of some kind?
Title: Re: Regarding Python flask
Post by: Juanito on March 13, 2019, 11:29:16 AM
Those files are not required for things to work, so you would be removing unneeded bloat, which is the tinycore way  :)