ECommerce site built from scratch using the Django framework.
Ecommerce & Blog Web Application with User Authentication and Stripe Payments
This Web App was built as a final project for the Code Institute's classroom bootcamp. It is a Ecommerce site built with Python's Django framework - no template was used.
Follow this link to view deployed version of the web app https://conor-dev-summaries.herokuapp.com/
This Project was deployed and is hosted on Heroku with automatic deploys from GitHub
When running locally, SQLite database was used & static and media files were stored locally. When deploying, Heroku Postgres was used as the server database & an Amazon S3 bucket was set up to host all the static files. settings.py file was amended for the database & static files to point to the online resources.
Follow the below instructions to clone this project for Mac (commands will be slightly different for Windows)
$ git clone https://github.com/conorc470/django-ecommerce-project.git
$ python3 -m venv ~/virtualenvs/name_of_environment
Activate: $ source ~/virtualenvs/name_of_environment/bin/activate
$ pip install -r requirements.txt
#!/bin/sh
export SECRET_KEY=''
export DEBUG='True'
export STRIPE_PUBLISHABLE_KEY=''
export STRIPE_SECRET_KEY=''
# TO RUN LOCALLY HAVE THESE TWO UNCOMMENTED #
# STATIC_URL = '/static/'
# MEDIA_URL = '/media/'
# TO RUN ON HEROKU HAVE THESE UNCOMMENTED #
AWS_S3_OBJECT_PARAMETERS = { # see http://developer.yahoo.com/performance/rules.html#expires
'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT',
'CacheControl': 'max-age=94608000',
}
AWS_STORAGE_BUCKET_NAME = os.environ.get('BUCKET_NAME')
AWS_S3_REGION_NAME = 'eu-west-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
STATICFILES_LOCATION = 'static'
STATICFILES_STORAGE = 'custom_storages.StaticStorage'
STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)
MEDIAFILES_LOCATION = 'media'
DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
To this:
# TO RUN LOCALLY HAVE THESE TWO UNCOMMENTED #
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
# TO RUN ON HEROKU HAVE THESE UNCOMMENTED #
# AWS_S3_OBJECT_PARAMETERS = { # see http://developer.yahoo.com/performance/rules.html#expires
# 'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT',
# 'CacheControl': 'max-age=94608000',
# }
#
# AWS_STORAGE_BUCKET_NAME = os.environ.get('BUCKET_NAME')
# AWS_S3_REGION_NAME = 'eu-west-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
#
# STATICFILES_LOCATION = 'static'
# STATICFILES_STORAGE = 'custom_storages.StaticStorage'
# STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)
#
# MEDIAFILES_LOCATION = 'media'
# DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'
# MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {'default': dj_database_url.parse(os.environ.get('DATABASE_URL')) }
To this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# DATABASES = {'default': dj_database_url.parse(os.environ.get('DATABASE_URL')) }
$ python manage.py migrate
- this will apply migrations to your local sqlite database
$ python manage.py createsuperuser
- this will create admin support
$ python manage.py runserver
- should say starting development server..Automated tests can be viewed in the tests.py file within the separate Apps. To run the tests, in your terminal navigate to the folder with your project in, activate your virtual environment and type:
$ python manage.py test <app name>