Media being served in development

This commit is contained in:
lwark
2025-09-17 11:27:41 -05:00
parent c18d84c3fb
commit 138ded28fe
7 changed files with 16 additions and 21 deletions

View File

@@ -393,9 +393,7 @@ class CreateForm(forms.Form, SpamProtectionMixin):
),
max_length=models.URLPath.SLUG_MAX_LENGTH,
)
# preview_text = forms.CharField(
# label=_("Preview Text"),
# )
content = forms.CharField(
label=_("Contents"), required=False, widget=getEditor().get_widget()
) # @UndefinedVariable

View File

@@ -415,17 +415,6 @@ class ArticleRevision(BaseRevisionMixin, models.Model):
),
)
# preview_text = models.CharField(
# max_length=1024,
# verbose_name=_("preview text"),
# null=False,
# blank=False,
# default="",
# help_text=(
# "Please fill out the preview text."
# )
# )
# TODO:
# Allow a revision to redirect to another *article*. This
# way, we can have redirects and still maintain old content.

View File

@@ -1,5 +1,5 @@
{% extends "wiki/base.html" %}
{% load wiki_tags i18n sekizai_tags static %}
{% load wiki_tags i18n sekizai_tags %}
{% block wiki_pagetitle %}{{ article.current_revision.title }}{% endblock %}

View File

@@ -148,10 +148,7 @@
<script src="{% static "wiki/bootstrap/js/bootstrap.bundle.min.js" %}"></script>
<script src="{% static "wiki/js/respond.min.js" %}"></script>
<script src="{% static "wiki/js/previewlink.js" %}"></script>
<script>
window.addEventListener("DOMContentLoaded", setupLinkPreview('a.internal-link', '.wiki-article'), false);
</script>
{% render_block "js" %}
</body>

View File

@@ -1,9 +1,14 @@
{% extends "wiki/article.html" %}
{% load wiki_tags i18n sekizai_tags %}
{% load wiki_tags i18n sekizai_tags static %}
<!-- view.html -->
{% block wiki_contents_tab %}
{% wiki_render article %}
<!--https://runebook.dev/en/articles/django/ref/settings/std:setting-X_FRAME_OPTIONS-->
<script src="{% static "wiki/js/previewlink.js" %}"></script>
<script>
window.addEventListener("DOMContentLoaded", setupLinkPreview('a.internal-link', '.wiki-article'), false);
</script>
{% endblock %}

View File

@@ -28,6 +28,7 @@ DEBUG = True
ALLOWED_HOSTS = []
# NOTE: allow frame links for the same base url
# https://runebook.dev/en/articles/django/ref/settings/std:setting-X_FRAME_OPTIONS
X_FRAME_OPTIONS = 'SAMEORIGIN'
# Application definition
@@ -134,6 +135,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/5.2/howto/static-files/
STATIC_URL = 'static/'
MEDIA_URL = 'media/'
# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field

View File

@@ -14,6 +14,8 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
@@ -22,4 +24,6 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('notifications/', include('django_nyt.urls')),
path('', include('wiki.urls'))
]
] #+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)