Skip to content

Python and Data Centric Development: A full-stack site that allows users to add, edit, delete and search hiking trails in the Province of Andalucia, Spain. They can also upload photos and maps showing their trails. Each route will provide: A title, Address of the trail , Difficulty level, Description, Directions , Photos, Maps

Notifications You must be signed in to change notification settings

nikimacm/trailmixers-project3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Website Mokup

TrailMixer

Overview

TrailMixers is a website where users can add, edit, delete and search hiking trails in the Province of Andalucia, Spain. They can also upload photos and maps showing their trails. Each route will provide:

  • A title
  • Address of the trail
  • Difficulty level, Easy, moderate or hard
  • Description
  • Directions
  • Photos
  • Maps

The site will also provide a comment section where users can give opinions or tips and advice on the trails, where to eat, sleep nearby etc.

I have created three profiles for testing purposes:

  1. Username:Inesita, Password:inesita
  2. Username:Admin, Password:admin
  3. Username:felipe, Password:felipe

View Live Site Here

Contents

Overview

Mobile

Desktop

UX

Project Goals

The goal of this project is to utilize the skills aquired throughout the course so far to build a full-stack site that allows users to manage and share data on hiking trails in Andalucia.

The site should provide users with information on Andalucian trails and also give the oppportunity to create a community where users can share their experiences.

A possible benefit for the owner of the site could be to obtain revenue from advertising through affiliated links and sponsorship.

User Goals

  1. To be able to search and browse through trails in Andalucia.

  2. Find all the information necessary for each trail like distance, difficulty level, address and directions.

  3. To create a personal profile to upload and store trails.

  4. To be able to register and create a profile easily.

  5. Find out more information on potential trails by reading comments and asking questions.

  6. Become part of a hiking community and give tips and advice to other hikers.

  7. To view photos of the trails and surrounding areas.

User Stories

  1. As a hiker I want to be able to find interesting and off the beaten track trails used by other members of the site.

  2. As a regular user I want to be able to upload my own trails to share with the community and get opinions on my trail.

  3. As someone who is interested in hiking in Andalucia I want to find trails that will suit my needs.

  4. As someone who isn't used to hiking I would like to find trails which are easy to moderate level.

  5. As a very experienced hiker, I hope to find difficult trails that will challenge me.

  6. As a regular user I hope to meet other users who live in my area and can organise hikes together.

  7. As a user I would like to be able to see more posts and photos on the sites social media sites.

Site Owner Goals

  1. Design a site which represents the services offered and will appeal to the target market using appropriate colour schemes, imagery, typography and useful information.

  2. Ensure the site is easy to navigate and all information can be found by visitors within seconds.

  3. Ensure the registration process is simple and fast.

  4. Increase website traffic from the target audience using tools such as google analytics, blogging and social media.

  5. Produce a site which is easily accessible on all sizes, mobile devices and browsers.

  6. To eventually gain revenue from the site through affiliated links and advertsiing. Potential clients could be sports shops, hotels ,restaurants and tour companies.

User Requirements and expectations

  1. A fast loading time.

  2. A website which is clear and easy to navigate.

  3. Recognisable format, no surprises.

  4. A well designed, aesthetically pleasing user interface.

  5. For all navigation links to function correctly and create an easy route.

  6. All information added is saved and easily accessible.

DESIGN

DESIGN CHOICES

I have used a clean, simple design throughout the site to make it easily accessible across all mediums and give the user the information they need without feeling overwhelmed by too many images and too much information.

COLOURS

I chose this color scheme as it reflects the colours of nature while assuring readabilty and accessability. I think these shades of green and brown go well together and are in line with the simplistic design of the site.

  • #00695c #00695c
  • #3e2723 #3e2723

FONTS

The fonts I use for this project are Alegreya Sans and Merriweather Sans. These fonts compliment each other well and create a pleasant feel for users.

IMAGES

Images used on the landing page were borrowed from a friend Lena Marie Anderson from a trail she hiked in Cadiz, Guadalete Park, Andalucia.

WIREFRAMES

Mobile

Desktop

FEATURES

Feature 1: Home Page

  • Home page navbar accessible to non registered users and users before they log in.

Navbar non registered users

  • Navbar accessible to logged in users. Once you log in you have access to trails and the ability to create your own trail, read it, edit it and delete it based on CRUD functionality.

Navbar non registered users

  • Get started button which leads you to the log in page which has a register button for users who haven't registered yet

Get Started Button

  • The footer at the bottom of the page has live links for the most popular trails in Andalucia. It also dislays the social media links.

Get Started Button

  • This is the registration page where potential users can add their name, surname, email, username and password, which will be stored on the database.

Registration Page

  • Once registered the user can log in here.

Log In Page

  • And they will be directed to their profile page with a welcome message based on their username

User Profile

  • From here the user can click on to the trails button to view all trails

All trails

  • Or click on the Add Trail button in the navbar to add their own trail.

Add trails

  • The user can search for a trail already saved in the database.

Search trails

  • Or edit or delete a trail they have already created by clicking on one of these buttons

Delete/Edit buttons

  • To edit, the user needs to ammend their trail using this form and press edit or cancel if they change their mind or rather do it later.

Edit trail

  • When the user is finished on the site they can click on the log out button on the navbar and be redirected to the homepage with a message telling them they have logged out successfully.

Log out

DATABASE

This is a data-centric website using html, javascript, jQuery and css used with materialize framework as a frontend The backend consists of Python, flask and jinja templates with a database of a mongodb open-source document-oriented database

MongdoDB was used to create the database. The MongoDB database holds the following information: -

Trails Collection

Key Value Information
_id ObjectId Automatically generated by MongoDB
trail_title String creates a title
trail_address String creates an address
trail_created_by String shows who added the trail
trail_description String Describes the trail
trail_difficulty String Choose a level of difficulty. Easy moderate or hard
trail_directions String Gives trail directions

Users Collection

Key Value Information
_id ObjectId Automatically generated by MongoDB
first_name String Collects first name
last_name String collects last name
username String collects username
password String stores password

TECHNOLOGIES USED

Languages used:

  • HTML 5
  • CSS
  • Javascript
  • JQuery
  • JQuery
  • Gitpod

    • Used Gitpod as my open source platform.
  • Github

    • Used Github as my code hosting platform
  • Google Fonts

    • This project uses Google fonts to style the website fonts.
  • Materialize

    • This project uses Bootstrap4 to simplify the structure of the website and make the website responsive
    • This project also uses BootstrapCDN to provide icons from FontAwesome
  • jQuery

    • This project uses jQuery to reference Javascript needed for the responsive navbar.
  • Popper.js

    • Popper.js was used to reference Javascript needed for the responsive navbar.
  • WAVE

    • Used WAVE to evaluate my code to ensure the content is fully accessable to individuals with disabilities.
  • W3 HTML

    • Used W3 HTMLs for HTML code valuation
  • Jigsaw CSS

    • Used Jigsaw CSS to Validate CSS Code
  • Balsamic

  • PEP8 Online

    • PEP8 Online For Python code valuation
  • JS Hint

    • JS Hint For Javascript code valuation

TESTING

User Goals Testing

User Goals Test

User Stories Testing

User Stories Test

User Requirements and Expecteations Testing

Site Owners Goals test

Performance Testing

Google Lighthouse was used to measure the speed and performance of the website.

Lighthouse

Accessibility

WAVE Web Accessibility Evaluation Tool was used to test the sites accessibility.

Validation

Validation tools used:

Validation Results

BUGS FOUND AND THEIR FIXES

  1. The major bug I had a problem with throughout this project was with an application error everytime I tried to open my Heroku App. This was eventually fixed by removing unused files I had uploaded to my root at the beginning of my project while trying to fix an issue with my database. Heroku was trying to open these files and as a result I kept getting a H10 error and pymong was crashing. Deleting these files and cleaning up my workspace cleared the issue and Heroku runs with no problems.

  2. For a while my env.py file would disappear everytime I opened my project after closing it down. I was clicking on the green gitpod button and realised I have to go to gitpod dashboard to open my workspace instead of going directly from github.

  3. I had a lot of template syntax errors throughout the project which usually resulted in mistakes made with PEP8 compliance and repeating functions and empty quotes. Also typos caused me a lot of headaches and I spent many hours/days going through my code trying to spot them.

  4. The python tools server crashed 3 times in the last 3 minutes was an alert I came across many times. When I deleted unused files from my root this was ammended.

  5. I had a lot of issues wiring up my flask app to MongoDB at the beginning of the project. I reviewed the Go Humungous with MongoDB Atlas section of the course and manipulated my data programmatically with python to get a feel of where I was going wrong and to see the data being uploaded to my console. This helped give me a greater understanding of the database structure and I got it in the end.

  6. The main reason for resubmission was due to the fact that my edit and delete buttons weren't functioning. I discovered a typo in my code on the trails.html page. In my if junja statement I had {% if session.user|lower == trail.created_by|lower %} trail_ is missing so I ammended it to {% if session.user|lower == trail.trail_created_by|lower %} and everything worked.

Deployment

Project creation

The project was created by logging into Github, using the following steps: -

  • Create an account using an email address and password or a google account
  • Log in to account and create a new repository using Code institutes template.
  • Name the repository based on your project name and be sure to include project 3. Then click the green Gitpod button which will take you to Gitpod.
  • Open the platform and start coding

Sign-in or sign-up to MongoDB

Sign-in or sign-up to MongoDB and create a new cluster Within the Sandbox, click the collections button and after click Create Database

I set up the following collections: comments, trails, ratings and users. However I only used the trails and users collections.

Trails Collection

Key Value Information
_id ObjectId Automatically generated by MongoDB
trail_title String creates a title
trail_address String creates an address
trail_created_by String shows who added the trail
trail_description String Describes the trail
trail_difficulty String Choose a level of difficulty. Easy moderate or hard
trail_directions String Gives trail directions

Users Collection

Key Value Information
_id ObjectId Automatically generated by MongoDB
first_name String Collects first name
last_name String collects last name
username String collects username
password String stores password

Next, under the Security Menu on the left, select Database Access.

Add a new database user, and keep the credentials secure

Within the Network Access option, add IP Address 0.0.0.0

In your IDE, create a file containing your environmental variables called env.py at the root level of the application. It will need to contain the following lines and variables:

  • import os

  • os.environ["IP"] = "0.0.0.0"

  • os.environ["PORT"] = "5000"

  • os.environ["SECRET_KEY"] = "YOUR_SECRET_KEY"

  • os.environ["DEBUG"] = "True"

  • os.environ["MONGO_URI"] = "YOUR_MONGODB_URI"

  • os.environ["MONGO_DBNAME"]= "DATABASE_NAME"

Please note that you will need to update the SECRET_KEY with your own secret key, as well as the MONGO_URI and MONGO_DBNAME variables with those provided by MongoDB.

To find your MONGO_URI, go to your clusters and click on connect. Choose connect your application and copy the link provided. Don't forget to update the necessary fields like password and database name.

If you plan on pushing this application to a public repository, ensure that env.py is added to your .gitignore file.

The application can now be run locally. In your terminal, type the following command

python3 app.py.

Deploying on Heroku:

Register for your free Heroku account and create a new app. Choose your region. Give the app your project name and choose what region you are in then click 'Create app'. Go to the settings tab and find the Config Vars section. Click 'Reveal Config Vars'. Ensure the Procfile and requirements.txt files exist are present and up-to-date in your local repository. For example: -

pip3 freeze --local > requirements.txt Procfile: echo web: python app.py > Procfile The Procfile should contain the following line: web: python app.py

Scroll down to "deployment method"-section. Choose "Github" for automatic deployment. From the inputs below, make sure your github user is selected, and then enter the name for your repo. Click "search". When it finds the repo, click the "connect" button. Scroll back up and click "settings". Scroll down and click "Reveal config vars". Set up the same variables as in your env.py (IP, PORT, SECRET_KEY, MONGO_URI and MONGODB_NAME): Do not set the DEBUG variable here. This should be set to False before deployment.

  • IP = 0.0.0.0
  • PORT = 5000
  • SECRET_KEY = YOUR_SECRET_KEY
  • MONGO_URI = YOUR_MONGODB_URI
  • MONGO_DBNAME = DATABASE_NAME

Scroll back up and click "Deploy". Scroll down and click "Enable automatic deployment". Just beneath, click "Deploy branch". Heroku will now start building the app. When the build is complete, click "view app" to open it. In order to commit your changes to the branch, use git push within gitpod to push your changes

CHANGES TO IMPLEMENT AND INCLUDE

Due to time constraints I did not manage to create a function to upload photos and maps to the site. I would also like to include a comment section below each trail so users can give their opinion on trails, ask questions or give advice. I would like to also include a rating function so the home page can include a trail of the day based on popularity. I hope to implement these in the future.

CREDITS

Code

I relied heavily on code used in the Code Institutes tutorials to help me with this project, especially Code Institutes Data-Centric mini project. I used these tutorials to guide me through the process of creating this site and all the functionality needed. I ammended the code to suit my own project.

I also used materialize to create responsive layouts. I was keen to try using this platform as it is new to me.

Images

Images were borrowed from a friend from her own personal collection.

ACKNOWLEDGEMENTS

Thank you to my mentor Mo Shami for getting me started on the project and veering me onto the right track. Thank you to Code Institutes' Student care team for all their help. And thanks to Jo from student support who helped me greatly in fixing the problem I had with Heroku app.

About

Python and Data Centric Development: A full-stack site that allows users to add, edit, delete and search hiking trails in the Province of Andalucia, Spain. They can also upload photos and maps showing their trails. Each route will provide: A title, Address of the trail , Difficulty level, Description, Directions , Photos, Maps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published