WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Regarding Python flask  (Read 2914 times)

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Regarding Python flask
« 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.

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Regarding Python flask
« Reply #1 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:
  • compiletc.tcz
  • setuptools.tcz
  • python.tcz
  • python-dev.tcz
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.



Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Regarding Python flask
« Reply #2 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

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Regarding Python flask
« Reply #3 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
« Last Edit: March 11, 2019, 12:11:56 AM by Juanito »

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Regarding Python flask
« Reply #4 on: March 11, 2019, 09:17:29 PM »
Thanks fellows for the tips, I'll give them a try.

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Regarding Python flask
« Reply #5 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?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Regarding Python flask
« Reply #6 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  :)