diff --git a/README b/README index e2c8245..bdc1da6 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ Running in production requires a WSGI host, which is way beyond the scope of thi Since both production and my local development instance have a large (500+) number of posts, behavior with a small number of posts is untested and undefined. I do know that the system assumes that there is at least one post, and the main page will error if that's not the case. Pull requests (or emailed git patches) to fix this or similar bugs would be accepted. -Disabling pagination is possible by editing ./main/pagination.py. +Disabling pagination is possible by editing ./thoughts/pagination.py. After cloning, you should create a `.env` to define environment variables. Read whispermaphone/settings.py. You can generate a SECRET_KEY with `python3 -c "import secrets; print(''.join([secrets.choice('abcdefghijklmnopqrstuvwxyz0123456789\!@#$%^&*(-_=+)') for i in range(50)]))"`. diff --git a/jetforce_app.py b/jetforce_app.py index 718d1be..6d26b26 100644 --- a/jetforce_app.py +++ b/jetforce_app.py @@ -7,7 +7,7 @@ from django.template.loader import render_to_string from django.utils import timezone django.setup() -from main.models import Thought +from thoughts.models import Thought from jetforce import GeminiServer, JetforceApplication, Response, Status @@ -20,7 +20,7 @@ app = JetforceApplication() def index(request): thoughts = Thought.objects.order_by("-posted") - rendered_text = render_to_string("whispermaphone/index.gmi", { + rendered_text = render_to_string("thoughts/index.gmi", { "thoughts": thoughts, }) diff --git a/templates/search/indexes/main/thought_text.txt b/templates/search/indexes/thoughts/thought_text.txt similarity index 100% rename from templates/search/indexes/main/thought_text.txt rename to templates/search/indexes/thoughts/thought_text.txt diff --git a/templates/search/search.html b/templates/search/search.html index 6d43c3c..aa8d156 100644 --- a/templates/search/search.html +++ b/templates/search/search.html @@ -1,4 +1,4 @@ -{% extends "whispermaphone/page.html" %} +{% extends "thoughts/page.html" %} {% block title %}Search{% if query %} "{{ query }}"{% endif %}{% endblock %} diff --git a/main/__init__.py b/thoughts/__init__.py similarity index 100% rename from main/__init__.py rename to thoughts/__init__.py diff --git a/main/apps.py b/thoughts/apps.py similarity index 74% rename from main/apps.py rename to thoughts/apps.py index 833bff6..635b09d 100644 --- a/main/apps.py +++ b/thoughts/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class MainConfig(AppConfig): - name = 'main' + name = "thoughts" diff --git a/main/feed.py b/thoughts/feed.py similarity index 92% rename from main/feed.py rename to thoughts/feed.py index 93e4e6e..dd07983 100644 --- a/main/feed.py +++ b/thoughts/feed.py @@ -1,6 +1,6 @@ from django.contrib.syndication.views import Feed -from main.models import Thought +from thoughts.models import Thought class MainFeed(Feed): diff --git a/main/migrations/0001_initial.py b/thoughts/migrations/0001_initial.py similarity index 100% rename from main/migrations/0001_initial.py rename to thoughts/migrations/0001_initial.py diff --git a/main/migrations/0002_auto_20200906_0324.py b/thoughts/migrations/0002_auto_20200906_0324.py similarity index 90% rename from main/migrations/0002_auto_20200906_0324.py rename to thoughts/migrations/0002_auto_20200906_0324.py index f4361ae..ac4a967 100644 --- a/main/migrations/0002_auto_20200906_0324.py +++ b/thoughts/migrations/0002_auto_20200906_0324.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('main', '0001_initial'), + ('thoughts', '0001_initial'), ] operations = [ diff --git a/main/migrations/0003_thought_uuid.py b/thoughts/migrations/0003_thought_uuid.py similarity index 86% rename from main/migrations/0003_thought_uuid.py rename to thoughts/migrations/0003_thought_uuid.py index 9d150b0..1edc028 100644 --- a/main/migrations/0003_thought_uuid.py +++ b/thoughts/migrations/0003_thought_uuid.py @@ -5,7 +5,7 @@ import uuid def add_uuids(apps, schema_editor): - Thought = apps.get_model("main", "Thought") + Thought = apps.get_model("thoughts", "Thought") for thought in Thought.objects.all(): thought.uuid = uuid.uuid4() thought.save() @@ -18,7 +18,7 @@ def reverse_add_uuids(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('main', '0002_auto_20200906_0324'), + ('thoughts', '0002_auto_20200906_0324'), ] operations = [ diff --git a/main/migrations/0004_thought_media.py b/thoughts/migrations/0004_thought_media.py similarity index 88% rename from main/migrations/0004_thought_media.py rename to thoughts/migrations/0004_thought_media.py index 1dd4d29..2d28081 100644 --- a/main/migrations/0004_thought_media.py +++ b/thoughts/migrations/0004_thought_media.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('main', '0003_thought_uuid'), + ('thoughts', '0003_thought_uuid'), ] operations = [ diff --git a/main/migrations/0005_thought_media_alt.py b/thoughts/migrations/0005_thought_media_alt.py similarity index 88% rename from main/migrations/0005_thought_media_alt.py rename to thoughts/migrations/0005_thought_media_alt.py index c9a2cb5..63428b9 100644 --- a/main/migrations/0005_thought_media_alt.py +++ b/thoughts/migrations/0005_thought_media_alt.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('main', '0004_thought_media'), + ('thoughts', '0004_thought_media'), ] operations = [ diff --git a/main/migrations/0006_alter_thought_text.py b/thoughts/migrations/0006_alter_thought_text.py similarity index 87% rename from main/migrations/0006_alter_thought_text.py rename to thoughts/migrations/0006_alter_thought_text.py index 7dada0d..0ad6a35 100644 --- a/main/migrations/0006_alter_thought_text.py +++ b/thoughts/migrations/0006_alter_thought_text.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('main', '0005_thought_media_alt'), + ('thoughts', '0005_thought_media_alt'), ] operations = [ diff --git a/main/migrations/__init__.py b/thoughts/migrations/__init__.py similarity index 100% rename from main/migrations/__init__.py rename to thoughts/migrations/__init__.py diff --git a/main/models.py b/thoughts/models.py similarity index 100% rename from main/models.py rename to thoughts/models.py diff --git a/main/pagination.py b/thoughts/pagination.py similarity index 100% rename from main/pagination.py rename to thoughts/pagination.py diff --git a/main/search_indexes.py b/thoughts/search_indexes.py similarity index 86% rename from main/search_indexes.py rename to thoughts/search_indexes.py index 361f36b..0ebc932 100644 --- a/main/search_indexes.py +++ b/thoughts/search_indexes.py @@ -2,7 +2,7 @@ from haystack import indexes from .models import Thought class ThoughtIndex(indexes.SearchIndex, indexes.Indexable): - text = indexes.CharField(document=True, use_template=True, template_name="search/indexes/main/thought_text.txt") + text = indexes.CharField(document=True, use_template=True, template_name="search/indexes/thoughts/thought_text.txt") posted = indexes.DateTimeField(model_attr="posted") def get_model(self): diff --git a/main/settings_context_processor.py b/thoughts/settings_context_processor.py similarity index 100% rename from main/settings_context_processor.py rename to thoughts/settings_context_processor.py diff --git a/main/static/images/apple-touch-icon.png b/thoughts/static/images/apple-touch-icon.png similarity index 100% rename from main/static/images/apple-touch-icon.png rename to thoughts/static/images/apple-touch-icon.png diff --git a/main/static/images/favicon-16x16.png b/thoughts/static/images/favicon-16x16.png similarity index 100% rename from main/static/images/favicon-16x16.png rename to thoughts/static/images/favicon-16x16.png diff --git a/main/static/images/favicon-192x192.png b/thoughts/static/images/favicon-192x192.png similarity index 100% rename from main/static/images/favicon-192x192.png rename to thoughts/static/images/favicon-192x192.png diff --git a/main/static/images/favicon-32x32.png b/thoughts/static/images/favicon-32x32.png similarity index 100% rename from main/static/images/favicon-32x32.png rename to thoughts/static/images/favicon-32x32.png diff --git a/main/static/images/favicon.ico b/thoughts/static/images/favicon.ico similarity index 100% rename from main/static/images/favicon.ico rename to thoughts/static/images/favicon.ico diff --git a/main/static/images/favicon.png b/thoughts/static/images/favicon.png similarity index 100% rename from main/static/images/favicon.png rename to thoughts/static/images/favicon.png diff --git a/main/static/main/codehighlight.css b/thoughts/static/thoughts/codehighlight.css similarity index 100% rename from main/static/main/codehighlight.css rename to thoughts/static/thoughts/codehighlight.css diff --git a/main/static/main/login.css b/thoughts/static/thoughts/login.css similarity index 100% rename from main/static/main/login.css rename to thoughts/static/thoughts/login.css diff --git a/main/static/main/main.css b/thoughts/static/thoughts/main.css similarity index 100% rename from main/static/main/main.css rename to thoughts/static/thoughts/main.css diff --git a/main/static/main/post.css b/thoughts/static/thoughts/post.css similarity index 100% rename from main/static/main/post.css rename to thoughts/static/thoughts/post.css diff --git a/main/templates/whispermaphone/about.gmi b/thoughts/templates/thoughts/about.gmi similarity index 100% rename from main/templates/whispermaphone/about.gmi rename to thoughts/templates/thoughts/about.gmi diff --git a/main/templates/whispermaphone/about.html b/thoughts/templates/thoughts/about.html similarity index 99% rename from main/templates/whispermaphone/about.html rename to thoughts/templates/thoughts/about.html index e6e960f..94dab04 100644 --- a/main/templates/whispermaphone/about.html +++ b/thoughts/templates/thoughts/about.html @@ -1,4 +1,4 @@ -{% extends "whispermaphone/page.html" %} +{% extends "thoughts/page.html" %} {% block title %}About{% endblock %} diff --git a/main/templates/whispermaphone/index.gmi b/thoughts/templates/thoughts/index.gmi similarity index 100% rename from main/templates/whispermaphone/index.gmi rename to thoughts/templates/thoughts/index.gmi diff --git a/main/templates/whispermaphone/index.html b/thoughts/templates/thoughts/index.html similarity index 98% rename from main/templates/whispermaphone/index.html rename to thoughts/templates/thoughts/index.html index 14f39f5..ee567dd 100644 --- a/main/templates/whispermaphone/index.html +++ b/thoughts/templates/thoughts/index.html @@ -1,4 +1,4 @@ -{% extends "whispermaphone/page.html" %} +{% extends "thoughts/page.html" %} {% load static %} {% block title %}Thoughts{% endblock %} @@ -13,7 +13,7 @@ {% block head %} - + {% endblock %} {% block main %} diff --git a/main/templates/whispermaphone/login.html b/thoughts/templates/thoughts/login.html similarity index 85% rename from main/templates/whispermaphone/login.html rename to thoughts/templates/thoughts/login.html index 5e4b702..f5b6262 100644 --- a/main/templates/whispermaphone/login.html +++ b/thoughts/templates/thoughts/login.html @@ -1,10 +1,10 @@ -{% extends "whispermaphone/page.html" %} +{% extends "thoughts/page.html" %} {% load static %} {% block title %}Post{% endblock %} {% block head %} - + {% endblock %} {% block navigation %} diff --git a/main/templates/whispermaphone/page.html b/thoughts/templates/thoughts/page.html similarity index 95% rename from main/templates/whispermaphone/page.html rename to thoughts/templates/thoughts/page.html index 0eddc0c..bc3abc7 100644 --- a/main/templates/whispermaphone/page.html +++ b/thoughts/templates/thoughts/page.html @@ -6,7 +6,7 @@ {% block title %}{% endblock %} {% load static %} - + {% block head %}{% endblock %} diff --git a/main/templates/whispermaphone/post.html b/thoughts/templates/thoughts/post.html similarity index 98% rename from main/templates/whispermaphone/post.html rename to thoughts/templates/thoughts/post.html index b20a512..2b18754 100644 --- a/main/templates/whispermaphone/post.html +++ b/thoughts/templates/thoughts/post.html @@ -1,10 +1,10 @@ -{% extends "whispermaphone/page.html" %} +{% extends "thoughts/page.html" %} {% load static %} {% block title %}Post{% endblock %} {% block head %} - + {% endblock %} {% block navigation %} diff --git a/main/templatetags/__init__.py b/thoughts/templatetags/__init__.py similarity index 100% rename from main/templatetags/__init__.py rename to thoughts/templatetags/__init__.py diff --git a/main/views.py b/thoughts/views.py similarity index 95% rename from main/views.py rename to thoughts/views.py index f99f994..fd70361 100644 --- a/main/views.py +++ b/thoughts/views.py @@ -53,7 +53,7 @@ def index(request): thoughts = requested_page.get_all_entries() - return render(request, "whispermaphone/index.html", { + return render(request, "thoughts/index.html", { "thoughts": thoughts, "highlighted": highlighted_uuid, "authenticated": authenticated, @@ -75,7 +75,7 @@ def login(request): # Returning 401 here causes `links` to always prompt for HTTP basic auth, which is annoying. # But the alternative is not following the HTTP spec, so I think this is fine. - return render(request, "whispermaphone/login.html", status=401) + return render(request, "thoughts/login.html", status=401) def post(request): @@ -111,7 +111,7 @@ def post(request): except: error_line = f"An unknown error occurred processing your request: {errors}" - return render(request, "whispermaphone/post.html", { + return render(request, "thoughts/post.html", { "form": thought_form, "form_error": error_line }, status=400) @@ -156,13 +156,13 @@ def post(request): return redirect(editing_thought) return redirect("post") - return render(request, "whispermaphone/post.html", { + return render(request, "thoughts/post.html", { "form": ThoughtForm(instance=editing_thought) if editing_thought else ThoughtForm(), "editing": not not editing_thought, }) def about(request): - return render(request, "whispermaphone/about.html", { + return render(request, "thoughts/about.html", { "authenticated": check_authenticated(request) }) diff --git a/whispermaphone/settings.py b/whispermaphone/settings.py index bf3a39d..e235a4d 100644 --- a/whispermaphone/settings.py +++ b/whispermaphone/settings.py @@ -45,7 +45,7 @@ INSTALLED_APPS = [ "haystack", - "main", + "thoughts", ] HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor" @@ -80,7 +80,7 @@ TEMPLATES = [ "context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", - "main.settings_context_processor.add_settings" + "thoughts.settings_context_processor.add_settings" ], }, }, diff --git a/whispermaphone/urls.py b/whispermaphone/urls.py index 9a1c746..abb1a6c 100644 --- a/whispermaphone/urls.py +++ b/whispermaphone/urls.py @@ -1,8 +1,8 @@ from django.conf.urls.static import static from django.urls import path, include -from main import views -from main.feed import MainFeed +from thoughts import views +from thoughts.feed import MainFeed from whispermaphone import settings from haystack.views import SearchView, search_view_factory