Django-2.1 (bigmomma_venv) clivenoonan:~/workspace (master)
I am currently a student at the Code Institute Studying Full Stack Diploma in ## Software Development.
This is the fifth of five projects which I must complete in order to be awarded the globally recognised Diploma from Edinburgh Napier University.
This Application is a eCommerce SurfStore website, the concept of this idea came from a few days surfing in inchydoney..
The name for the store came from , my son & step sons , when did would see the big waves coming they would shout out "The big mommas are coming"
The need for this eCommerce store comes from the increase in the surfing culture in Ireland, with steady growth, &
if we get another summer like the one we just did , then there will be a big demand for surf boards & surf gear
.
My Main Interest for this project was to work off my surfing experience in a few days surfing in inchydoney Ireland this summer,
This indent of this eCommerce app is indented to make it as easy & pain free to purchase a surf board & accessories
The site is designed in such a way that its not very easy to get lost , most of the interaction between the application & the
This eCommerce app also makes use of Django pagination , each page holds a maximum of 6 products, so as to not overwhelm the Customer
With a fixed nav bar, that moves with the customer, it is easy to bail out of the app asap, this does not annoy the customer & completely
shop with ease, With access to all the features such as the shop categories , the search bar , signin & signout aswell as the products,
Our Accounts/Signin/Signout links are located on our frontpage in the navabar, # the navbar is also fixed to our page , so when the customer is scrolling the
making the cart very easly accessible to the customer on the font page , this link brings us to the cart & checkout page
When the user dicides to purchase a product & cicks on the product the #customer is brought the single product page , here they still have the abilty to bail out or access the rest of the website
The customer also has the ability to increase the number of products or decrease the number of products that are considering to purchase.
When the user has decided to pay for there purcahse they are presented with a ## Stripe popup payment box where they fill in the fields related to there user ## account & complete a purchase with there card in seconds & have the abilty to choose 2 step verfication , from mobile phone.
After the user has finisehd there purcahse they are transported to there thank you page , where they are informed of there order number
The orders tab for each user is located in there profile icon on the navbar this is also accessible anywhere on the page
After the user has finisehd there purcahse & there thank you page has come thru , the user will be sent an email from the Mial gun email API, this email will arrive in the from a HTML Templte to there email address that signed up wit.
In this eCommerce Application the back end admin has the abitly to create users, update & create products & catergories & Content with the use of Django richTextEditor
I hope to develop on this project in the future to an even bigger online ecommerce Store with a frontend react & a backend rest api auth system
-
Django 2 - The project uses Django 2 for rapid web development, clean design & a pragmatic approach
-
Stripe - The project uses Stripe Payment integration.
-
Cloud9 - The project uses Cloud9 to Write/Code & format syntax in various languages.
-
- The project uses Heroku as an app deployment hosting platform for my application
-
- The project uses https://us-east-2.console.aws.amazon.com/console to serve static content & media files
-
- The project uses https://travis-ci.org/ for continues testing intergration, test passsing on git repo
-
- The project uses https://www.mailgun.com/ for email delivery service integration with Mailgun
-
- The project uses Adobe Ai to create the Logo
-
- The project uses https://github.com/ to version control the development project
-
- The project uses BootStrap4 to assist the Developer with a built in css library -,aswell as reusable components
-
- The project uses fontawesome to inhance webfonts &
- increase seo conversion, also to assist the developer in creating a consistant textual flow
-
- The project uses HTML5 to house the sturcture & the base semantics.
-
- The project uses CSS3 to to Style the elements & Responsive WebDesign.
-
- The project uses Js to add interactivity & to interact with stripe.
-
- The project uses GoogleFonts to enhance the visual text & ensure readabilty on various platforms & screens
- also to inhance webfonts & increase seo conversion,
-
- The project uses LightHouseChromeExstention to test seo data & accsseibitly & best practices
-
- The project uses validator.w3 to test seo data & accsseibitly & best practices
-
- The project uses jigsaw.w3 to test validation of CSS3 -also to test seo data & accessibility & best practices
-
- The project uses https://compressor.io/ to compress images
- W3C for HTML.
- W3C for CSS.
- JS Hint for JavaScript.
- TravisCI for Continues testing tests passing on github
Tested On
- Chrome.
- Internet Explorer.
- Microsoft Edge.
- Firefox.
- Opera.
- Continous design Testing SonyXsperia Mobile Phone
- Continous design Testing Windows10XL Mobile Phone
- Continous design Testing 42 Inch sharpSmart Led TV
- All Browsers & Mobile devices Display the whole site as was intended
- LightHouse
USER1 : gets wind of an awesome surfing website where he can buy surfboards, he finds the link thru soacial media & connects , he browses the site for a few minutes & decides he might make a purchase , he completes his purchase with out having to create an account Test1 User1 ( True/False ) Was User1 able to complete his purchase with out having to create an account? True
USER2: is just packing up from surfing for the day, when she hears an advert on the radio about an online surf shop , she clicks on ,after being in the water all day she fills in her details incorrectly, she tries again with all the correct details , but being in such a hurry , she never finishes the task , so she puts the phone down , when she arrives home , she brings her mobile with her , she puts it down , her daugther picks it up & begins exploring the website, she gets thru most of it & discovers the cart , she manages to get all the way with a pink surfboard she quite fancied, she gets to the stripe popup box, & recalls her dad working treiesly on something the exact same on his computer, she remembers what to do , she manages to remeber the test long password with the same numbers , then she remembers the easy one with 3 numbers ,
She is then left with the calender, she does not qiute understand this type of calender, so she fills in what she knows and carrys on , she see,s the little box shake with disagreement & decides she better put it away
Test1 User2 ( True/False ) Was User2 able to create an account when she filled in her details incorrectly? Falsh Was User2 daugther able to make a purchase when she filled in her details incorrectly? falsh RESULT 100%
USER3 is coming home from work on the bus he begins to shoulder surf another passengers laptop , as he admires the website he retrives his mobile from his pocket & reads the address, connects to the website, he attempts signing up for the first time , USER3 has only been using a mobile for a week he has spent most of his life on the beach, must be why his eyes are so good, he fills in his details with the first name & the last name as the same name, he then attempts to only enter in 6 characters in the passsword field, with an incorrect email address ,
After a bit of a shock from all the errors he concetrates on the insructions before him , after a few minutes studying , he fills out all the info correctly, except for his email address, he then attempts for the second time to register an account , observing the error , he realises he has forgotten his @ symbol , he then corrects his typo & proceeds ,
Test1 User3 ( True/False ) Was User3 able to create an account when he filled in his details incorrectly? Falsh Was User3 able to create an account when he filled in his details with just the @ symbol missing? falsh Was User3 able to create an account when he filled in his details correctly? True RESULT 100%
This Full Stack Framework eCommecre application looks & responses very very well across all screen sizes
There is one problem with my application & it is a subscription I have been locked out of my mail gun because I mistakenly pushed an api key , after removing the api key from GitHub I proceeded to contact mailgun,There I followwed the support team I correcting all the details of my account , where I set up 2step verification using the Google Auth App but now I am totally locked out of my account.
I tried to signup for another account but they only except 1 mobile number & 1 credit card number My Project is ready & setup for email intergration as soon as mailgun unlocks my account, I am presently in contact with Mailgun,
- The stages to deploy this project were_
- first I needed to install dj-database-url, this is a package that allows us to connect to a database url
- Then I needed to install psycopg2 , this is a package that allows us to connect to a postgres heroku database
- next I needed to freeze my requirements to make sure all my packages are updated, heroku will build our app with these packages & all there packages
- next I have to make my imports into my settings.py file
- next I had to replace my database values with this code
- DATABASES = {'default': dj_database_url.parse(os.environ.get('DATABASE_URL')) }
- next I had to update my env.py file with my database tuple which is set with os.environ.setdefault('DATABASE_URL')
- I also extracted my secret key from my setting.py file & stored them in my env.py file with the same syntax of os.environ.setdefault('SECRET_KEY')
- Then I went back to my settings.py file & replaced back my secret key with this code os.environ.setdefault("SECRET_KEY", "")
- I then made migrated my database to my heroku postgres database, then I needed to create a superuser
- might have to add in here about rebuilding database
- In this section of the deployment process I had to create an account on aws with a unique name ,
- I had to receive an automated phone call from aws , once verification was complete , I had the ability to log in to my aws account
- next up was to create a bucket on aws with a unique name
- next I had to grant access to anyone so my applications static files could be accessed from anywhere,
- I carried out this task while still in the Set Properties section of the bucket creation, once created
- next up was to access my bucket & then to select Static website hosting,
- Permissions is next with a bucket policy , a bucket policy is what allows access to our bucket(contents of our bucket)
- I did this with a json configuration which is standard , I just needed to insert my own aws bucket details, which I already created
- next task was to create a group policy to allow users, I did with s3 & IAM aws webservices, I created a group.
- after this I had to create a policy but this time for the group ,
- next was to configure my arn credentials into my group policy json formatted document in the Policy Document text box on aws,
- then I validated & created the group policy, so next I had to find the policy for the group that I just created & attach it to my group
- next ws to create a user with programmatic access with the group permissions we had earlier created
- next task was to test our bucket with an image file , in order to do this I had to grant permissions in the process of uploading
- next task was to install django-storages & boto3 & add storage's to our installed apps , this packages will give us the abilty to connect Django to s3
- next up was to configure my aws config credentials , such as our bucket name our region name our accesss & our secret key,
- I also had to configure my custom domain & static files location in my setting.py file
- next task was to go back to our .env file & add our aws configuration details where they can be ignored by the our .gitignore file
- I was send aws keys from aws , these wee stored safely, these are highly sensitive keys , so I needed to configure these in our .en file
- The next step in this was to run the command collectstatic
- this was to collect the static files & our media files , but to do this I used the technuige of seperation of concerns,
- This technique allows us to seperate our media files & our satitc files
- In order to accomplish this I made a custom_storages.py file in our top level Directiory in our cloud9 IDE,
- so I had to import my S3BotoStorge into my custom_storages.py & create a class to declare a location of settings.py
- next was back agian to oui setings.py & I then configured the relevent location of static
- I then had change my storage.backends.s3boto3.S3Boto3Storage to custom_storages.StaticStorage to match the class we just created in our
- custom_storages.py file , then I had to finally run the command of collectstaic agian to transfer our static directory on aws s3
- next was to create a second class to represent our media files, which are now being served from aws & then once agian I needed to run
- Next task in this deployment was to setup & configure TravisCI continues integration , after authorising travis to access git hub account
- I then found my project & turned travis on , next is to click the not so obvious build failing tab/button,
- this will give you the option of a drop down box where we can select markdown as the chosen configuration, then we need to copy & paste
- markdown that travis gives us and insert into my README.md file , this is so travis can connect to our project/application.
- Next up was to create a travis.yml file and code in the configuration to declare python as our language
- also configure our requirements details so travis knows what packages to rebuild in order test our app
- Git add ,Git commit, Git push were next up,
- I first had to comment out my env file , so my application would run I then had
- to change my database because I will now be running my application from heroku,
- I achieved this within an if statement which also acts as a point of access for Travis in my settings.py file
- Git add ,Git commit, Git push were next up,
- now that my app is ready for deployment on heroku I needed to configure my config vars,
- this involved transferring all my keys from my .env file with matching naming values from the project into the heroku interface cloud console,
- next I connected/synced my git repo with my heroku app again through the heroku interface cloud console
- I enabled automatic deployment from GitHub
- I then needed the package gunicorn , this package is required to connect to heroku server,
- I then added the package to my requirements.txt file, for heroku
- Then I created a Procfile , to establish with heroku what type of app is being served ,
- in my Procfile I configured the file with web: gunicorn bigmomma.wsgi:application,
- this is how heroku knows that this application is a Django application
- Git add ,Git commit, Git push were next up,
- Next I configured the collect static feature on heroku to 1, this will prevent heroku from upoading my static files
- Next I allowed my host in my setting.py file for heroku to open my application
- Git add ,Git commit, Git push were next up,
- Finally I deployed my application from git hub
My project can be viewed fully deployed on heroku here.
My GitHub repo can be viewed here
To Run this code Locally , a number of choices , you can go to github
- git clone
- Requirements - latest version of Python3 - Git - Django2 - IDE/PYCHARM/ installed on your pc,
- You will need to make sure you have python3 added to your system variables path,
- create a folder in your selected location, cd into your folder/project using your cli/commandline
- next you will need to create a virtual environment, with the command virtualenv env
- on Windows, virtualenv creates a batch file
- \env\Scripts\activate.bat
- to activate virtualenv on Windows, activate script is in the Scripts folder :
- \path\to\env\Scripts\activate
- Example:
- C:\Users'Username'\venv\Scripts\activate.bat
- StackOverFlow
- I wrote all the content
- The photos & videos used in this site were obtained from Pexels, Unsplash
I didn't base my work off other code, I used only what I had learnt in syllabuss1/LMS1 & syllabuss2/LMS2(cloud-9). & Django 2
- I received inspiration for this project from studying the Awesome Django FrameWork & Python Programming Language for the whole year , it was & is amazing