├── elevate
├── crm
│ ├── __init__.py
│ ├── migrations
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-311.pyc
│ │ │ └── 0001_initial.cpython-311.pyc
│ │ └── 0001_initial.py
│ ├── tests.py
│ ├── admin.py
│ ├── __pycache__
│ │ ├── apps.cpython-311.pyc
│ │ ├── urls.cpython-311.pyc
│ │ ├── admin.cpython-311.pyc
│ │ ├── models.cpython-311.pyc
│ │ ├── views.cpython-311.pyc
│ │ └── __init__.cpython-311.pyc
│ ├── apps.py
│ ├── urls.py
│ ├── views.py
│ ├── models.py
│ └── templates
│ │ └── crm
│ │ └── index.html
├── elevate
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── urls.cpython-311.pyc
│ │ ├── wsgi.cpython-311.pyc
│ │ ├── __init__.cpython-311.pyc
│ │ └── settings.cpython-311.pyc
│ ├── urls.py
│ ├── asgi.py
│ ├── wsgi.py
│ └── settings.py
├── db.sqlite3
├── static
│ ├── js
│ │ └── app.js
│ └── css
│ │ └── styles.css
└── manage.py
└── README.md
/elevate/crm/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/elevate/elevate/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/elevate/crm/migrations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/elevate/crm/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/elevate/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/db.sqlite3
--------------------------------------------------------------------------------
/elevate/crm/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | from . models import Profile
4 |
5 | admin.site.register(Profile)
6 |
--------------------------------------------------------------------------------
/elevate/static/js/app.js:
--------------------------------------------------------------------------------
1 |
2 | alert("Hello World");
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/elevate/crm/__pycache__/apps.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/__pycache__/apps.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/__pycache__/urls.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/__pycache__/urls.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/__pycache__/admin.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/__pycache__/admin.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/__pycache__/models.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/__pycache__/models.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/__pycache__/views.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/__pycache__/views.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/__pycache__/__init__.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/__pycache__/__init__.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/elevate/__pycache__/urls.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/elevate/__pycache__/urls.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/elevate/__pycache__/wsgi.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/elevate/__pycache__/wsgi.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/elevate/__pycache__/__init__.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/elevate/__pycache__/__init__.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/elevate/__pycache__/settings.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/elevate/__pycache__/settings.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class CrmConfig(AppConfig):
5 | default_auto_field = 'django.db.models.BigAutoField'
6 | name = 'crm'
7 |
--------------------------------------------------------------------------------
/elevate/crm/migrations/__pycache__/__init__.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/migrations/__pycache__/__init__.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/urls.py:
--------------------------------------------------------------------------------
1 |
2 | from django.urls import path
3 |
4 | from . import views
5 |
6 | urlpatterns = [
7 |
8 | path('', views.home, name=""),
9 |
10 | ]
11 |
--------------------------------------------------------------------------------
/elevate/crm/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 |
3 | # Create your views here.
4 |
5 | def home(request):
6 |
7 | return render(request, 'crm/index.html')
8 |
9 |
--------------------------------------------------------------------------------
/elevate/static/css/styles.css:
--------------------------------------------------------------------------------
1 |
2 | h1{
3 |
4 | color: blue;
5 |
6 | }
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/elevate/crm/migrations/__pycache__/0001_initial.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloud-with-django/s3-reference-project/HEAD/elevate/crm/migrations/__pycache__/0001_initial.cpython-311.pyc
--------------------------------------------------------------------------------
/elevate/crm/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | from django.contrib.auth.models import User
4 |
5 | class Profile(models.Model):
6 |
7 | profile_pic = models.ImageField(null=True, blank=True)
8 |
9 | user = models.ForeignKey(User, max_length=10, on_delete=models.CASCADE, null=True)
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/elevate/crm/templates/crm/index.html:
--------------------------------------------------------------------------------
1 |
2 | {% load static %}
3 |
4 |
5 |
6 |
7 |
8 | Elevate | Homepage
9 |
10 |
11 |
12 |
13 |
14 | Hello world!
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/elevate/elevate/urls.py:
--------------------------------------------------------------------------------
1 |
2 | from django.contrib import admin
3 | from django.urls import path, include
4 |
5 | from django.conf import settings
6 |
7 | from django.conf.urls.static import static
8 |
9 |
10 | urlpatterns = [
11 |
12 | path('admin/', admin.site.urls),
13 |
14 | path('', include('crm.urls')),
15 |
16 | ]
17 |
18 | urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/elevate/elevate/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for elevate project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'elevate.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/elevate/elevate/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for elevate project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'elevate.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/elevate/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | """Run administrative tasks."""
9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'elevate.settings')
10 | try:
11 | from django.core.management import execute_from_command_line
12 | except ImportError as exc:
13 | raise ImportError(
14 | "Couldn't import Django. Are you sure it's installed and "
15 | "available on your PYTHONPATH environment variable? Did you "
16 | "forget to activate a virtual environment?"
17 | ) from exc
18 | execute_from_command_line(sys.argv)
19 |
20 |
21 | if __name__ == '__main__':
22 | main()
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # About the project
2 |
3 | A Django project serving as a reference guide for integrating Amazon S3 for file storage and retrieval.
4 |
5 | # Support
6 |
7 | If you like this project and want to leave a donation, you are more than welcome to support this project down below:
8 |
9 | [](https://donate.stripe.com/28o4hEeFg5mcc3C9AE)
10 |
11 | # Connect
12 |
13 | Feel free to connect with me on the following platforms:
14 |
15 | [](https://www.youtube.com/@CloudWithDjango)
16 |
17 | [](https://x.com/CloudWDjango)
18 |
--------------------------------------------------------------------------------
/elevate/crm/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 4.2.7 on 2023-11-04 16:07
2 |
3 | from django.conf import settings
4 | from django.db import migrations, models
5 | import django.db.models.deletion
6 |
7 |
8 | class Migration(migrations.Migration):
9 |
10 | initial = True
11 |
12 | dependencies = [
13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14 | ]
15 |
16 | operations = [
17 | migrations.CreateModel(
18 | name='Profile',
19 | fields=[
20 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21 | ('profile_pic', models.ImageField(blank=True, null=True, upload_to='media/')),
22 | ('user', models.ForeignKey(max_length=10, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
23 | ],
24 | ),
25 | ]
26 |
--------------------------------------------------------------------------------
/elevate/elevate/settings.py:
--------------------------------------------------------------------------------
1 |
2 | from pathlib import Path
3 |
4 | # Build paths inside the project like this: BASE_DIR / 'subdir'.
5 | BASE_DIR = Path(__file__).resolve().parent.parent
6 |
7 |
8 | # Quick-start development settings - unsuitable for production
9 | # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
10 |
11 | # SECURITY WARNING: keep the secret key used in production secret!
12 | SECRET_KEY = 'django-insecure-+z06aeyv7n7l^8!(fl=q)rd2gr8qniqd&b6zu($&4q1*yn21!i'
13 |
14 | # SECURITY WARNING: don't run with debug turned on in production!
15 | DEBUG = True
16 |
17 | ALLOWED_HOSTS = []
18 |
19 |
20 | # Application definition
21 |
22 | INSTALLED_APPS = [
23 | 'django.contrib.admin',
24 | 'django.contrib.auth',
25 | 'django.contrib.contenttypes',
26 | 'django.contrib.sessions',
27 | 'django.contrib.messages',
28 | 'django.contrib.staticfiles',
29 |
30 | 'crm',
31 |
32 | 'storages',
33 | ]
34 |
35 | MIDDLEWARE = [
36 | 'django.middleware.security.SecurityMiddleware',
37 | 'django.contrib.sessions.middleware.SessionMiddleware',
38 | 'django.middleware.common.CommonMiddleware',
39 | 'django.middleware.csrf.CsrfViewMiddleware',
40 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
41 | 'django.contrib.messages.middleware.MessageMiddleware',
42 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
43 | ]
44 |
45 | ROOT_URLCONF = 'elevate.urls'
46 |
47 | TEMPLATES = [
48 | {
49 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
50 | 'DIRS': [],
51 | 'APP_DIRS': True,
52 | 'OPTIONS': {
53 | 'context_processors': [
54 | 'django.template.context_processors.debug',
55 | 'django.template.context_processors.request',
56 | 'django.contrib.auth.context_processors.auth',
57 | 'django.contrib.messages.context_processors.messages',
58 | ],
59 | },
60 | },
61 | ]
62 |
63 | WSGI_APPLICATION = 'elevate.wsgi.application'
64 |
65 |
66 | # Database
67 | # https://docs.djangoproject.com/en/4.2/ref/settings/#databases
68 |
69 | DATABASES = {
70 | 'default': {
71 | 'ENGINE': 'django.db.backends.sqlite3',
72 | 'NAME': BASE_DIR / 'db.sqlite3',
73 | }
74 | }
75 |
76 |
77 | # Password validation
78 | # https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
79 |
80 | AUTH_PASSWORD_VALIDATORS = [
81 | {
82 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
83 | },
84 | {
85 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
86 | },
87 | {
88 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
89 | },
90 | {
91 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
92 | },
93 | ]
94 |
95 |
96 | # Internationalization
97 | # https://docs.djangoproject.com/en/4.2/topics/i18n/
98 |
99 | LANGUAGE_CODE = 'en-us'
100 |
101 | TIME_ZONE = 'UTC'
102 |
103 | USE_I18N = True
104 |
105 | USE_TZ = True
106 |
107 |
108 | # Static files (CSS, JavaScript, Images)
109 | # https://docs.djangoproject.com/en/4.2/howto/static-files/
110 |
111 |
112 | MEDIA_URL = 'media/'
113 |
114 | MEDIA_ROOT = BASE_DIR / 'media'
115 |
116 |
117 | STATIC_URL = 'static/'
118 |
119 | STATICFILES_DIRS = [BASE_DIR / 'static']
120 |
121 |
122 | # Default primary key field type
123 | # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
124 |
125 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
126 |
127 |
128 |
129 | # AWS configuration
130 | '''
131 |
132 | AWS_ACCESS_KEY_ID = ''
133 | AWS_SECRET_ACCESS_KEY = ''
134 |
135 | '''
136 |
137 | # Basic Storage configuration for Amazon S3 (Irrespective of Django versions)
138 |
139 | '''
140 |
141 | AWS_STORAGE_BUCKET_NAME = '' # - Enter your S3 bucket name HERE
142 |
143 | AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
144 |
145 | AWS_S3_FILE_OVERWRITE = False
146 |
147 | '''
148 |
149 |
150 | # Django < 4.2
151 |
152 | '''
153 |
154 | DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
155 | STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
156 |
157 | '''
158 |
159 | # Django 4.2 >
160 |
161 | '''
162 |
163 | STORAGES = {
164 |
165 | # Media file (image) management
166 | "default": {
167 | "BACKEND": "storages.backends.s3boto3.S3StaticStorage",
168 | },
169 |
170 | # CSS and JS file management
171 | "staticfiles": {
172 | "BACKEND": "storages.backends.s3boto3.S3StaticStorage",
173 | },
174 | }
175 |
176 | '''
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------