MyProject4

Unicorn Attractor

Milestone Project 4

Build Status

ABOUT MY APP


This is my fourth and final milestone project for Code Institute. The app that I have created is for a made up game called Unicorn Attractor. My site allows users to log bug reports that they have found in the game or to add feature requests for a small fee that when the target amount has been reached the feature that was requested will be worked on and then implemented into the game.

Here you will find a link to my website via HEROKU: https://myproject4-mcilgrew.herokuapp.com

Here you will find a link to my code via GITHUB: https://kososwede.github.io/MyProject4/

UX


USER STORIES

As a user to this website I would like to be able to:

WIREFRAMES

I created these wireframes using BALSAMIQ. I created wireframes for desktop and mobile versions of my app so that it would be available and easy to navigate no matter what device you have. The wireframes can be found here:

FEATURES


FUNCTIONALITY

My app uses Python logic so users can login or register. The app offers Create, Read, Update and Delete features that allow users to create, read, update and delete tickets. Upvoting tickets require a small donation

FEATURES AVAILABLE NOW

FUTURE FEATURES

With alot more knowledge and time I would like to add the followinf features:

TECHNOLOGIES USED


TESTING


My website was tested in Chrome, Firefox, Safari, Opera and Microsoft Edge. It was also tested on android and ios devices and all worked as it should. A link from HEROKU was sent to my family and friends in England to make sure that it worked on all of their devices. All buttons worked and opened in a different browser window. I was testing my website at every major point in production to make sure everything I was implementing was working and running smoothly. Every button has been tested to make sure that it has the correct reaction. My HTML5 CSS3 and my PYTHON code have all been checked in:

#### TRAVIS CONTINUOUS INTEGRATION Travis CI - Used for continuous Integration testing of my code

DEPLOYMENT


GitHub was used for my version control and Heroku to host the live version of my website. To deploy it to Heroku i used these steps:

  1. I created the app in Heroku
  2. Clicked on Resources and typed in Postgres and select Free hobby level
  3. Add the DATABASE_URL info to my env.py
  4. Create an environment variable in my settings.py that can grab the info from my env.py
  5. Import the dj_database_url package in my settings.py
  6. Ran python3 manage.py makemigrations then python3 manage.py migrate to migrate models into Heroku Postgres
  7. Copied and pasted the contents of my env.py file and added them to the config vars in Heroku
  8. Connected my app to the GitHub repository in the Deploy tab and selected **Enable Automatic DEPLOYMENT
  9. In Stripe I went to the Developers section and selected the API Keys
  10. I copied and pasted the Publishable Key and the Secret Key and then set them as the STRIPE_PUBLISHABLE and STRIPE_SECRET environment variables in my env.py file in my local workspace
  11. I then updated the settings.py file with the new Stripe environment variables
  12. Created a new S3 Bucket in the S3 section of AWS
  13. In the bucket permissions, I changed the **CORS Configurations to: ```<?xml version=”1.0” encoding=”UTF-8”?>
* GET HEAD 3000 Authorization
14. Also in the **S3** section, the **Bucket Policy** was changed to this:

{ “Version”: “2012-10-17”, “Statement”: [ { “Sid”: “PublicReadGetObject”, “Effect”: “Allow”, “Principal”: “*”, “Action”: “s3:GetObject”, “Resource”: “arn:aws:s3:::/*" } ] }

15. I then replaced ```<my-bucket-name>``` in the ```Resource``` line with my own **S3** Buckets name instead
16. In the **IAM** section of **AWS** I created a new group and attached my **S3** Bucket details into it
17. Also in the **IAM** section I created a 'New Policy' along with 'New User' and attached these to the new group
18. I then updated the settings.py file in my local workspace with the relevant **S3** Bucket details

AWS_S3_OBJECT_PARAMETERS = { ‘Expires’: ‘Thu, 31 Dec 2099 20:00:00 GMT’, ‘CacheControl’: ‘max-age=9460800’, }

AWS_STORAGE_BUCKET_NAME = ‘mcilgrews-myproject4’ AWS_S3_REGION_NAME = ‘eu-north-1’ AWS_ACCESS_KEY_ID = os.environ.get(“AWS_ACCESS_KEY_ID”) AWS_SECRET_ACCESS_KEY = os.environ.get(“AWS_SECRET_ACCESS_KEY”) AWS_S3_CUSTOM_DOMAIN = ‘%s.s3.amazonaws.com’ % AWS_STORAGE_BUCKET_NAME AWS_DEFAULT_ACL = None

19. The settings.py file was then updated with configuration for static file storage
20. Ran ``python3 manage.py collectstatic`` to push the static files to the **S3** Bucket I created
21. I then created a requirements.txt file using ``pip3 freeze > requirements.txt`` in the terminal window
22. A **Procfile** was then created in the terminal window ``echo web: gunicorn unicorn_attractor.wsgi:application > Procfile``
23. Ran ``git add .``, ``git commit -m "<message>"`` and then ``git push`` to push all my changes to my **GitHub** Repository

**My app was then deployed to Heroku**

To be able to run my code locally, users can download a copy of my code to their desktop by following these steps:

1. Go to my [GitHub repository](https://github.com/kososwede/MyProject4)

2. Click on 'Clone or download' under the repository name

3. Then copy the clone URL for the repository in the 'Clone with HTTPs section'

4. Open 'Git Bash' in your local IDE

5. Change your current working directory to the location where you want the cloned directory to be made

6. Type ``git clone``, then paste the URL you copied in Step 3:

``git clone https://github.com/USERNAME/REPOSITORY``

7. Press Enter to complete and create your local clone.

8. In your local workspace set your own credentials for the environment variables:
Create a ``.env,py`` file with your own credentials and import this into the settings.py file
9. Install the ``requirements.txt`` file by running this command in your CLI Terminal:
``pip3 install -r requirements.txt``
10. Then run the following command in your Terminal to launch the Django project:
``python3 manage.py runserver $IP:$PORT``
11. Click the ``http://`` link in the terminal, and the project will load
12. Then you can run the following commands to migrate the database models and create a super user:

python3 manage.py makemigrations python3 manage.py migrate python3 manage.py createsuperuser ``` When migrations are complete and super user created, the site should run locally.

CREDITS


MEDIA

AKNOWLEDGEMENTS