Nearly everyday on any UF FaceBook page you can expect to see a lost and found post. Keys, wallets, ID’s, laptops, and all kinds of other lost items are posted.
Here’s an example:
After seeing
Let’s get started with the totally-altruistic-and-not-self-serving development of the website.
GatorLostAndFound.com
This series will follow the development of a new website called GatorLostAndFound.com or GatorLF for short.
I’m going to develop the site using Python (specifically the Flask web development framework).
I want to make it clear that this series is not a tutorial on Python or Flask. Although I will be explaining as I develop the web application, I assume you have at least some
I have a few target features in mind:
- Sign-up with Facebook O-Auth to make life easy
- Sort lost items by type, geographic area, date, and other filters
- E-mail notifications to renew posts after 30 days without activity
- Messaging or comments between users to communication and arrange for the return of lost items
This is just a quick list of general preliminary features and will almost certainly change over time.
Domain Name
Fortunately, the domain name was an easy choice. I always use NameCheap as my domain registrar and once again, it didn’t disappoint. I registered the domain name
GatorLostAndFound.com
for just $8.88 for the first year.
Setting up a GitHub repository
As with most of my programming/development projects, I’ll begin by creating a GitHub repository. I’m lazy so I created a blank repo with the GitHub web interface and initialized a blank readme.md file.
Here’s the repo: https://github.com/seanziegler/GatorLF
Let’s clone the repo to our local machine by running the following commands:
cd C:\Users\Sean Ziegler\Coding
git clone https://github.com/seanziegler/GatorLF.git
Awesome, our repo is ready to go.
Python, pip, venv
I’m going to develop this using python 3.6 so I’ll check to ensure I have a current version of python installed.
python --version
> Python 3.6.4
Great, lets update pip to the latest version. (This is a little more annoying than usual since I only have access to a Windows laptop currently, it’s much nicer in a UNIX environment)
python -m pip install --upgrade pip
Now we will install and create a virtual environment to make sure we only use the packages specifically needed in this project, not other junk installed on my machine.
virtualenv venv
Now let’s create a .gitignore file and add the virtualenv to it so that it’s not housed on GitHub. For window’s I’ll just create the file with explorer, but Linux users could run:
touch .gitignore
nano .gitignore
I’ll add the venv folder and .pyc files.
venv/
*.pyc
Don’t forget to activate your venv.
Windows:
venv\Scripts\activate.bat
Linux:
source venv/bin/activate
Installing necessary packages
Okay, we are finally ready to start installing packages. First we are going to need Flask.
pip install Flask
I’ll be using SQLAlchemy and Alembic for database creation and migration so I’m going to install those for future use.
pip install Flask-Migrate
pip install Flask-Alembic
Okay, time to generate a requirements file so that our packages can be easily installed on another machine if we ever needed.
pip freeze > requirements.txt
Here is what our requirements file looks like at this point:
alembic==1.0.8
Click==7.0
Flask==1.0.2
Flask-Alembic==2.0.1
Flask-Migrate==2.4.0
Flask-SQLAlchemy==2.3.2
itsdangerous==1.1.0
Jinja2==2.10
Mako==1.0.8
MarkupSafe==1.1.1
python-dateutil==2.8.0
python-editor==1.0.4
six==1.12.0
SQLAlchemy==1.3.1
Werkzeug==0.15.1
Pushing to GitHub
All that’s left for now is to push what we have done so far up to GitHub.
git add .
git commit -m "init commit"
git push origin master
In part two, we will build a Hello World application.