Orientation for COMP 353/453
Below are installation and setup instructions for each module of the course:
- General course orientation
- Database design and SQL
- All students may skip installation entirely and simply use the
Virtual Machine that is available. You still have to submit
Orientation Screenshots, to demonstrate that you are able to login, to
access your database, to build a basic application using Flask, and so
forth, but you may do these activities using the Virtual Machine.
Further, it is not an "either/or" choice. You may install the
environment on your own computer, and you may also use a Virtual
Machine when it is convenient for you to do so, or in case you have any
database connection issues.
to install XAMPP (If you are using a Mac, skip to the bullet point "What about Mac users?")
- Why XAMPP? We're not using PHP!!!
- XAMPP is a convenient way to install MySQL (or its clone, MariaDB) and Apache, without having to install each component
separately and getting them to work together.
- PHPMyAdmin widely used as a convenient GUI that comes with
XAMPP. It is used to manage/view/test MySQL databases, regardless of the application language.
- You could certainly use the localhost setup by XAMPP
together with your python programs. In our case, we will not,
since it's easier to use flask for that. But you certainly could,
and many do.
- Do you have to use XAMPP?
- NO! If you want to use WAMP-Server, or AMPS, or even install
each component separately, you may do so.
- Do you have to use PHPMYAdmin to see and work on my database? What about IDLE for editing my Python code?
- NO! I will demonstrate many
of our queries on PHPMyAdmin, and use it for "quick-and-dirty" database
checks, even when using Python. You may use WorkBench, or HeidiSQL,
or pyMySQL, of Raspberry Pi, or PyCharm, or any type of database connection and any IDE you want to use. If
you use an alternative setup,
please make sure you can access and view your database, and send
similar screenshots to the ones required in this orientation. On
the Mac, since we'll be installing Anaconda, you might want to use
Sypder, especially on the Mac, if you don't have a separate Python 3
installation beyond Anaconda's. (Sypder comes with your Anaconda
- What about Mac users?
- Please submit a screenshot on Sakai, for the assignment named Orientation: XAMPP/MAMP Installation screenshot , as per the instructions in the assignment.
PHPMyAdmin and set up a root user and a new user username and password
to test your XAMPP/MAMP installation Please take a screenshot (as per instructions) and submit on Sakai to the assginment named Orientation: Test MySQL/PHP Installation
to test your command-line (Terminal) installation Please take a screenshot (as per instructions) and submit on Sakai to the assginment named Orientation: Test Terminal (Command Line) Installation
- If you have difficulty with the installation, or for some
feel that you cannot install it, or if you do not a laptop available
for this installation, you can request from me a Virtual Machine that
has a WAMP stack already installed. Please let me know as soon as
possible, as I have to request this VM from our tech support staff!!
- If you are installing on the VM, you may see a pop up warning
about the activated User Account Control, etc. Ignore it.
It should install in C:\ instead of in the Programs(86) folder.
- You may also want to install SublimeText, atom, TextWrangler (or any good text editor) on the mac, or Notepad++ on
Windows. (You can even install Notepadd++ on the Mac, using
Winebottler, but that's really out of scope for this course.)
- For modeling your ER diagrams, use any modeling tool you want. As a fallback position, you may use even Word or PPT. MUCH BETTER: try ER Assistant (Windows only); Gliffy;something like Draw.io (I don't prefer their EER notation, but no biggie); StarUML; ErDraw (ok EER notation) Dia (Windows or mac); Lucid (You can keep renewing the free trial); ERDPlus (seems cool and very clear!) has been a student favorite in past semesters;
- Python, Flask, flask-sqlAlchemy
https://www.python.org/ There is a checkbox in the installation box to add Python to the Windows path. Check that box!!
- If you want to use PyCharm or any other IDE, feel free to do
so, but you are responsible for making sure that you can run flask,
install all packages, and connect to the database both through
flask_sqlalchemy and through the other database connectors that we use
- Anaconda: https://www.anaconda.com/download/ For the Mac, be very careful to install the Anaconda version for Python 3.x!!
- On Windows: I
already had Python installed, and installing Anaconda over my existing Python
installation works just fine.
Mac: Python 2 comes installed with a Mac OS. However, you
want Python 3. You do not have to install it separately (although
you certainly may). When you install Anaconda 3, Python 3.x will
be installed, if you are careful to select the Python 3.x version when you download/install.
- Windows: Anaconda installation will give you an option to add python to the path. Say "Yes"!!!
- Mac: Anaconda will automatically add python and anaconda to the $PATH. You can always check: https://www.datacamp.com/community/tutorials/installing-anaconda-mac-os-x
is recommended to create a new “virtual environment” in Anaconda for each
project. For this course, I will only
use one environment; therefore I will be using the (base) environment. Feel free to setup multiple environments, but it is not required for this course, nor will I demonstrate it.
- Flask installation:
from within your Anaconda environment:
- (This means, on Windows, Start-->Anaconda-->Anaconda
prompt). On Mac, start the Anaconda Navigator, and open a
terminal window. In both cases, you should see the prompt with
your acanconda environment, for instance (base), as part of the prompt.)
- pip install flask-sqlalchemy
- pip install flask-login
- pip install flask-bcrypt
go into Python (type python at the command prompt, from within anaconda)
- type import flask. There should be no error.
- type import flask_sqlalchemy
- type exit()
- Take a screenshot from within Anaconda terminal/command, showing import flask with no error.
- Flask test HelloWorld
- Download the zip file which contains the sample code that you will need for the Python ORM part of the course. Unzip.
There will be a few (very few) changes in the Mac version, so here is the Mac zip file. The Virtual Machine already has everything downloaded onto
- Watch the first three minutes of the video, and duplicate the HelloWorld app.
- Take a screenshot of "Hello, World!" on your web browser .
- Submit the import Flask screenshot and the Flask HelloWorld screenshot for the assignment named Orientation: Screenshot of Fask Installation and HelloWorld.
note: The folder structure in the video is slightly different
from the one that I give
you in the zip file that you downloaded. In the video, the
flaskHelloWorld.py program is in the folder FlaskDemoLectures.
However, I changed it slightly after making the video. Your
flaskHelloWorld.py program is in Flask-Demo/Lectures/1-GettingStarted
of your unzipped folder structure. When I navigate to the folder
containing the flaskHelloDemo.py program, be sure that you navigate to
the folder where your program is located.
of database packages: (There are no specific orientation assignments
for this part, since Lab-4a-connect covers this material.
However, I am including it here, so that all installation instructions
are in one place, and also because you may want to get things up and
running earlier than required. Recommended. Strongly.)
- BTW, Mac users. Sometimes, there are just too many configuration issues or conflicts to make this local installation worth your while. You may want to seriously consider using the VM.
- MySQL connector: From within your Anaconda environment:
- MySQL Client and MySQLdb:
- From within your Anaconda environment, attempt:
- pip install mysqlclient
You may get an error that you don't have the VB Build Tools
installed (I have not experienced that error on the Mac, nor have
I found others who have encountered it.)
- Windows and Mac:
conda install -c bioconda mysqlclient (Ignore any warnings about
conda packages being deprecated. It is a bug in conda and is
being fixed as of this writing.)
- pip install Flask-mysqldb
- WTF Forms: From within your environment (Anaconda):
- Text editor of your choice
- As we build our applications, we may be required to install additional components