Browse Source

Access files locally

master
alfred 1 year ago
parent
commit
bbc6f42779

+ 3
- 13
dynzine/settings/default.py View File

@@ -128,18 +128,8 @@ AUTH_USER_MODEL = 'engine.Author'
128 128
 DJAWTH_PROJECT = 'dynzine-dev'
129 129
 LAST_ARTICLES_NUM = 5
130 130
 
131
-AWS_ACCESS_KEY_ID = ''
132
-AWS_SECRET_ACCESS_KEY = ''
133
-AWS_STORAGE_BUCKET_NAME = 'dev-stuff'
134
-AWS_S3_CUSTOM_DOMAIN = f's3.wasabisys.com/{AWS_STORAGE_BUCKET_NAME}'
135
-AWS_S3_ENDPOINT_URL = 'https://s3.wasabisys.com'
136
-AWS_DEFAULT_ACL = 'public-read'
137
-DEFAULT_FILE_STORAGE = 'engine.storage.MediaStorage'
138
-EXTERNAL_MEDIA_PATH = 'dynzine'
139 131
 MEDIA_FILE_OVERWRITE = True
140 132
 
141
-FIXTURES_AVATARS = [
142
-    f'dev/256_{n + 1}.png'
143
-    for n in range(16)
144
-]
145
-COVER_FIXTURE = 'dev/dev-cover.jpg'
133
+COVER_FIXTURE = 'imgs/cover/cover.jpg'
134
+MEDIA_ROOT = 'resources/'
135
+MEDIA_URL = '/dev/'

+ 4
- 2
engine/fixtures.py View File

@@ -2,10 +2,12 @@ import factory
2 2
 from factory import fuzzy
3 3
 import uuid
4 4
 from faker import Faker
5
-from django.conf import settings
5
+import os
6 6
 
7 7
 
8 8
 fake = Faker()
9
+IMAGES_PATH = os.path.join('resources/imgs/avatars')
10
+AVAILABLE_IMAGES = [f'imgs/avatars/{f}' for f in os.listdir(IMAGES_PATH)]
9 11
 
10 12
 
11 13
 class ZineFactory(factory.django.DjangoModelFactory):
@@ -21,7 +23,7 @@ class AuthorFactory(factory.django.DjangoModelFactory):
21 23
     uuid = factory.LazyFunction(uuid.uuid4)
22 24
     name = factory.Faker('name')
23 25
     bio = factory.Faker('paragraph', nb_sentences=15)
24
-    picture = fuzzy.FuzzyChoice(settings.FIXTURES_AVATARS)
26
+    picture = fuzzy.FuzzyChoice(AVAILABLE_IMAGES)
25 27
     dynzine = ZineFactory()
26 28
 
27 29
 

+ 13
- 1
engine/static/styles/dynzine.css View File

@@ -69,12 +69,18 @@ a:hover {
69 69
 }
70 70
 
71 71
 .title span {
72
-    margin: 50px 0 25px 0;
72
+    margin: 50px 0 0 0;
73 73
     font-weight: bold;
74 74
 }
75 75
 
76 76
 .title .authors-list {
77 77
     width: 100%;
78
+    display: flex;
79
+    justify-content: center;
80
+}
81
+
82
+.title .author {
83
+    margin-top: 50px;
78 84
 }
79 85
 
80 86
 .title .authors-list h3 {
@@ -97,6 +103,7 @@ a:hover {
97 103
     min-height: 25vh;
98 104
     justify-content: center;
99 105
     justify-items: center;
106
+    min-width: 350px;
100 107
 }
101 108
 
102 109
 .title .authors-list a {
@@ -233,12 +240,17 @@ footer {
233 240
 .footer-container {
234 241
     height: 100%;
235 242
     flex: 1 1 auto;
243
+    justify-content: center;
236 244
 }
237 245
 
238 246
 .partial-footer {
239 247
     padding: 50px;
240 248
 }
241 249
 
250
+.partial-footer-layout {
251
+    min-width: 450px;
252
+}
253
+
242 254
 .partial-footer h2 {
243 255
     color: white;
244 256
     margin-top: 25px;

+ 3
- 3
engine/templates/base.html View File

@@ -31,9 +31,9 @@
31 31
   <footer>
32 32
       {% block footer %}
33 33
       <div class="pure-g footer-container">
34
-      <div class="pure-u-1-3"><div class="partial-footer">{% include 'partials/footer-info.html' %}</div></div>
35
-      <div class="pure-u-1-3"><div class="partial-footer">{% include 'partials/footer-page.html' %}</div></div>
36
-      <div class="pure-u-1-3"><div class="partial-footer">{% include 'partials/footer-about.html' %}</div></div>
34
+      <div class="pure-u-1-3 partial-footer-layout"><div class="partial-footer">{% include 'partials/footer-info.html' %}</div></div>
35
+      <div class="pure-u-1-3 partial-footer-layout"><div class="partial-footer">{% include 'partials/footer-page.html' %}</div></div>
36
+      <div class="pure-u-1-3 partial-footer-layout"><div class="partial-footer">{% include 'partials/footer-about.html' %}</div></div>
37 37
       </div>
38 38
       {% endblock %}
39 39
       <div class="license">

+ 1
- 1
engine/templates/home.html View File

@@ -10,7 +10,7 @@
10 10
         <span>Created by:</span>
11 11
         <div class="pure-g authors-list">
12 12
             {% for author in dynzine.visible_authors.all %}
13
-            <div class="pure-u-1-{{ dynzine.visible_authors.count }}">
13
+            <div class="pure-u-1-{{ dynzine.visible_authors.count }} author">
14 14
                 <a href="{% url 'author' slug=author.slug uuid=author.uuid %}">
15 15
                     {% if author.picture %}<img src="{{ author.picture.url }}" />{% endif %}
16 16
                 <h3>{{ author }}</h3>

+ 4
- 4
engine/urls.py View File

@@ -4,8 +4,9 @@
4 4
 from django.urls import path, reverse_lazy
5 5
 from django.views.generic import TemplateView, DetailView
6 6
 from django.contrib.auth.views import LogoutView
7
-from django.utils.functional import lazy
7
+from django.conf.urls.static import static
8 8
 from django.contrib.auth.decorators import login_required
9
+from django.conf import settings
9 10
 from .djawth import URLS
10 11
 from . import models
11 12
 from . import views
@@ -58,6 +59,5 @@ urlpatterns = [
58 59
     path('<slug>', DetailView.as_view(
59 60
         template_name='article.html',
60 61
         queryset=models.Article.objects
61
-    ), name='article'),
62
-]
63
-
62
+    ), name='article')
63
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

BIN
resources/imgs/avatars/256_1.png View File


BIN
resources/imgs/avatars/256_10.png View File


BIN
resources/imgs/avatars/256_11.png View File


BIN
resources/imgs/avatars/256_12.png View File


BIN
resources/imgs/avatars/256_13.png View File


BIN
resources/imgs/avatars/256_14.png View File


BIN
resources/imgs/avatars/256_15.png View File


BIN
resources/imgs/avatars/256_16.png View File


BIN
resources/imgs/avatars/256_2.png View File


BIN
resources/imgs/avatars/256_3.png View File


BIN
resources/imgs/avatars/256_4.png View File


BIN
resources/imgs/avatars/256_5.png View File


BIN
resources/imgs/avatars/256_6.png View File


BIN
resources/imgs/avatars/256_7.png View File


BIN
resources/imgs/avatars/256_8.png View File


BIN
resources/imgs/avatars/256_9.png View File


BIN
resources/imgs/cover/cover.jpg View File


Loading…
Cancel
Save