Add a new blog
December 16

Data types in Python 3

Numbers     Integers: Like in math, integers in computer programming are whole numbers that can be positive, negative, or 0 (…, -1, 0, 1, …). An integer can also be known as an int. As with other programming languages, you should not use commas in numbers of four digits or more, so when you write 1,000 in your program, write it...

December 11

Simple Python Flask Rest API

Setup project folder: $ mkdir flask-rest-api; cd flask-rest-api $ python3 -m venv venv $ source venv/bin/activate Check your env, make sure it is the version that you should run on:  $ python -V; pip -V Install flask and packages: $ pip install flask flask-sqlalchemy marshmallow psycopg2-binary Generate freeze requirement text file: $ pip3 freeze > requirements.txt  Create your file $ touch Use any code editor to work on your project.  ...

December 10

Run your Python Flask app with existing Apache server

If you already have an EC2 with Apache, you can use it to run your Python Flask app. Install and Enable mod_wsgi: $ sudo apt-get install libapache2-mod-wsgi-py3 python-dev $ sudo a2enmod wsgi  Create a Flask app if you don't have one. See my other blog for create / run flask app.  Configure and Enable a New Virtual Host: $ sudo nano /etc/apache2/sites-available/MyFlaskApp.conf Add the following conf code...

December 10

Install Flask on Ubuntu 18.04

Check your Python version:  $ python -V  $ python3 -V Run your Flask app with python 3. You can set your defaul python with python3 if that is what you want with a simple HACK: $  sudo ln -s /usr/bin/python3 /usr/bin/python Best to run your app in venv, install python venv if not in your system:  sudo apt install python3.x-venv Create your project folder and create new virutal...

April 2

Python VirtualEnv HowTo

Create python virtualenv in a dir for python3 $ cd codefolder $ python3 -m venv venv  (or, $ virtualenv -p python3 . ) Start your virtualenv again $ source yourvenv/bin/activate Exit python virtualevn $ deactivate Shorthand to create virtualenv and folder $ virtualenv yourvenv -p python3 Install django $ pip install django==3.1.5 ...

June 23

Creating a Stand Alone Executable from a Python Script using PyInstaller

1. go to 2. install PyInstaller from PyPI pip install pyinstaller 3. run pyinstaller --onefile -w if you want only one output file and without opening console terminal pyinstaller --onefile -w 4. (for windows) if your program requires additional  packages, you can use NSIS (Nullsoft Scriptable Install System) download and install it.  (watch video above to see how to do it properly). ...

Send us a message. We will reply as soon as we can.