User:Pedro Sá Couto/Prototyping 5th/Flask App/Raspberry Pi into a Flask App Server: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
Line 1: Line 1:
=Installing Flask in a Raspberry Pi=
=Installing Flask in a Raspberry Pi=
<br><br>
 
Install virtual environment
===01 Install virtual environment===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
sudo apt install python3-venv
sudo apt install python3-venv
</pre>
</pre>


Go to www folder
===02 Go to www folder===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
cd /var/www/
cd /var/www/
</pre>
</pre>


Create a flask app server here
===03 Create a flask app server here===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
sudo mkdir TacticalApp
sudo mkdir TacticalApp
</pre>
</pre>


Go into the folder
===04 Go into the folder===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
cd TacticalApp
cd TacticalApp
</pre>
</pre>


Create a virtual environment in this folder
===05 Create a virtual environment in this folder===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
sudo python3 -m venv venv
sudo python3 -m venv venv
</pre>
</pre>


Check who owns the venv
===06 Check who owns the venv===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
stat venv/
stat venv/
</pre>
</pre>


Change the owner to your user (mine is mrb)
===07 Change the owner to your user (mine is mrb)===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
sudo chown -R mrb:mrb venv
sudo chown -R mrb:mrb venv
</pre>
</pre>


Activate de virtual environment
===08 Activate de virtual environment===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
. venv/bin/activate
. venv/bin/activate
</pre>
</pre>


Deactivate de virtual environment
===09 Deactivate de virtual environment===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
deactivate
deactivate
</pre>
</pre>


Install Flask
===10 Install Flask===
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;">
pip3 install flask
pip3 install flask
</pre>
</pre>

Latest revision as of 23:06, 29 March 2020

Installing Flask in a Raspberry Pi

01 Install virtual environment

sudo apt install python3-venv

02 Go to www folder

cd /var/www/

03 Create a flask app server here

sudo mkdir TacticalApp

04 Go into the folder

cd TacticalApp

05 Create a virtual environment in this folder

sudo python3 -m venv venv

06 Check who owns the venv

stat venv/

07 Change the owner to your user (mine is mrb)

sudo chown -R mrb:mrb venv

08 Activate de virtual environment

. venv/bin/activate

09 Deactivate de virtual environment

deactivate

10 Install Flask

pip3 install flask