Final project of the Algorithmic Complexity course.
The recommendation is to install miniconda by downloading from here and install with default options
If you already have Anaconda installed, or prefer to use Anaconda (larger version) download from here and install with default options.
We create virtual environment to host the flask dependencies. If you use anaconda you can use the graphical explorer. Here are the steps to install using command line:
First we open Anaconda Prompt
or Anaconda Prompt (miniconda3)
and we execute
the following commands:
conda update --all
conda create -n comple
conda activate comple
conda update --all
conda install pip
python -m pip install -U pip
python -m pip install Flask
Then with our favorite python editor or IDE we create a file called hello.py
and write the following program: hello.py
.
hello.py
and write the following program:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
We save the file in a folder of our choice and then, from the previously opened command line, we go to that folder using the command
previously opened command line, we go to that folder using the command
cd, for example
cd "c:\UsersAkiraToriyama\My Documents", if your folder is on a different disk, first enter the disk name and then the command
cd, e.g.
d:d:
.
cd, for example d:
and then cd d:\test\test2\tf
.
Finally put the following command:
set FLASK_APP=hello.py
python -m flask run
The venv module supports the creation of lightweight "virtual environments", each with its own independent set of Python packages installed in its site directories. Virtual environments are recommended for software development projects that are usually derived from a single Python script, and Python provides multiple ways to create and use a virtual environment.
To use venv on your terminal run the following commands
py -m venv env
.\env\Scripts\activate
pip list
py -m pip install --upgrade pip
pip install Flask
pip install perlin-noise
cd "Your project path"
set FLASK_APP=tfapp
set FLASK_DEBUG=1
flask run
Command to change run port
python -m flask run -p 5000
Now, you will get a URL with a local IP and a port, for example
http://127.0.0.1:5000
, copy and paste that URL into your favorite browser.
For now you can place your algorithm, as explained in class, in the function peru1 function of algorithm.py. You must unpack the d.json.zip file directly into the static/data folder and run the application in the normal way, but with the static/data folder and run the application as normal, but with:
set FLASK_APP=tfapp.py
python -m flask run