-
Notifications
You must be signed in to change notification settings - Fork 0
Production-Ready Corporate CMS #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,72 @@ | ||
| # Python Visual Effects 🎬✨ | ||
|
|
||
| Python で作成した美しい視覚効果とアニメーションのコレクション | ||
|
|
||
| ## 機能 🌟 | ||
|
|
||
| - **🌈 レインボーテキスト**: 文字が色とりどりに表示される効果 | ||
| - **📝 タイプライター効果**: 文字が一文字ずつゆっくり現れる演出 | ||
| - **🖍️ カラータイプライター効果**: 文字ごとに色が変わるタイプライティング | ||
| - **🔄 スピナーエフェクト**: くるくる回るスピナーアニメーション | ||
| - **💻 マトリックス風エフェクト**: 日本語文字が緑色で画面を流れる | ||
| - **💥 爆発アニメーション**: 殡階的に拡大する爆発エフェクト | ||
|
|
||
| ## 実行方法 🚀 | ||
|
|
||
| ```bash | ||
| python3 hello.py | ||
| ``` | ||
|
|
||
| ## 必要な環境 📋 | ||
|
|
||
| - Python 3.x | ||
| - ターミナル/コマンドプロンプト (カラー表示対応) | ||
|
|
||
| ## デモ 🎥 | ||
|
|
||
| 実行すると以下のエフェクトが順番に表示されます: | ||
|
|
||
| 1. 長文のタイプライター効果でメッセージが表示 | ||
| 2. カラータイプライター効果 | ||
| 3. スピナーエフェクト | ||
| 4. レインボーカラーでテキストが輝く | ||
| 5. 日本語文字のマトリックス風エフェクト | ||
| 6. 爆発アニメーション | ||
|
|
||
| ## 技術詳細 🔧 | ||
|
|
||
| - **カラーエフェクト**: ANSI エスケープコードを使用 | ||
| - **アニメーション**: time.sleep() による時間制御 | ||
| - **文字セット**: 日本語ひらがな + 数字の組み合わせ | ||
|
|
||
| ## 作成者 👨💻 | ||
|
|
||
| Claude と協力して作成された視覚効果プロジェクト | ||
|
|
||
| --- | ||
|
|
||
| *美しいターミナルアートをお楽しみください!* ✨ | ||
| # Corporate CMS | ||
|
|
||
| A production-ready Corporate Content Management System built with Django. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Core Pages:** Manage static pages (About, Services, etc.) with a Rich Text Editor. | ||
| - **News/Blog:** Post company news with images, categories, and tags. | ||
| - **Contact Form:** Secure contact form with admin notification (messages saved to DB). | ||
| - **Admin Interface:** Fully customized admin dashboard for easy content management. | ||
| - **Responsive Design:** Built with Bootstrap 5. | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| - Python 3.12+ | ||
| - Django 4.2+ | ||
| - SQLite (Development) / PostgreSQL (Production ready) | ||
| - Bootstrap 5 | ||
| - Django Summernote (WYSIWYG Editor) | ||
|
|
||
| ## Setup Instructions | ||
|
|
||
| 1. **Clone the repository:** | ||
| ```bash | ||
| git clone <repository-url> | ||
| cd <repository-folder> | ||
| ``` | ||
|
|
||
| 2. **Create a virtual environment:** | ||
| ```bash | ||
| python -m venv venv | ||
| source venv/bin/activate # On Windows: venv\Scripts\activate | ||
| ``` | ||
|
|
||
| 3. **Install dependencies:** | ||
| ```bash | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| 4. **Run Migrations:** | ||
| ```bash | ||
| python manage.py migrate | ||
| ``` | ||
|
|
||
| 5. **Create a Superuser:** | ||
| ```bash | ||
| python manage.py createsuperuser | ||
| ``` | ||
|
|
||
| 6. **Run the Server:** | ||
| ```bash | ||
| python manage.py runserver | ||
| ``` | ||
| Or use the helper script: | ||
| ```bash | ||
| ./run.sh | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. Access the Admin Panel at `http://127.0.0.1:8000/admin/`. | ||
| 2. Login with your superuser credentials. | ||
| 3. Create Pages and News Posts. | ||
| 4. View the site at `http://127.0.0.1:8000/`. | ||
|
|
||
| ## Production Deployment Notes | ||
|
|
||
| - Set `DEBUG = False` in `config/settings.py`. | ||
| - Configure `ALLOWED_HOSTS`. | ||
| - Use a production database like PostgreSQL. | ||
| - Serve static files using Nginx/Apache. | ||
| - Use Gunicorn as the WSGI server. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| """ | ||
| ASGI config for config project. | ||
|
|
||
| It exposes the ASGI callable as a module-level variable named ``application``. | ||
|
|
||
| For more information on this file, see | ||
| https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ | ||
| """ | ||
|
|
||
| import os | ||
|
|
||
| from django.core.asgi import get_asgi_application | ||
|
|
||
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") | ||
|
|
||
| application = get_asgi_application() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| """ | ||
| Django settings for config project. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
| import os | ||
|
|
||
| # Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
| BASE_DIR = Path(__file__).resolve().parent.parent | ||
|
|
||
|
|
||
| # Quick-start development settings - unsuitable for production | ||
| # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ | ||
|
|
||
| # SECURITY WARNING: keep the secret key used in production secret! | ||
| SECRET_KEY = "django-insecure-6-#rm#!l-^n4l7@fiao&+qa4@mh@a1ilr#awypypf)-u%x8uli" | ||
|
|
||
| # SECURITY WARNING: don't run with debug turned on in production! | ||
| DEBUG = True | ||
|
|
||
| ALLOWED_HOSTS = ['*'] | ||
|
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Running with Useful? React with 👍 / 👎. |
||
|
|
||
|
|
||
| # Application definition | ||
|
|
||
| INSTALLED_APPS = [ | ||
| "django.contrib.admin", | ||
| "django.contrib.auth", | ||
| "django.contrib.contenttypes", | ||
| "django.contrib.sessions", | ||
| "django.contrib.messages", | ||
| "django.contrib.staticfiles", | ||
| "django_summernote", | ||
| "core", | ||
| "news", | ||
| "contact", | ||
| ] | ||
|
|
||
| MIDDLEWARE = [ | ||
| "django.middleware.security.SecurityMiddleware", | ||
| "django.contrib.sessions.middleware.SessionMiddleware", | ||
| "django.middleware.common.CommonMiddleware", | ||
| "django.middleware.csrf.CsrfViewMiddleware", | ||
| "django.contrib.auth.middleware.AuthenticationMiddleware", | ||
| "django.contrib.messages.middleware.MessageMiddleware", | ||
| "django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
| ] | ||
|
|
||
| ROOT_URLCONF = "config.urls" | ||
|
|
||
| TEMPLATES = [ | ||
| { | ||
| "BACKEND": "django.template.backends.django.DjangoTemplates", | ||
| "DIRS": [BASE_DIR / 'templates'], | ||
| "APP_DIRS": True, | ||
| "OPTIONS": { | ||
| "context_processors": [ | ||
| "django.template.context_processors.debug", | ||
| "django.template.context_processors.request", | ||
| "django.contrib.auth.context_processors.auth", | ||
| "django.contrib.messages.context_processors.messages", | ||
| ], | ||
| }, | ||
| }, | ||
| ] | ||
|
|
||
| WSGI_APPLICATION = "config.wsgi.application" | ||
|
|
||
|
|
||
| # Database | ||
| # https://docs.djangoproject.com/en/4.2/ref/settings/#databases | ||
|
|
||
| DATABASES = { | ||
| "default": { | ||
| "ENGINE": "django.db.backends.sqlite3", | ||
| "NAME": BASE_DIR / "db.sqlite3", | ||
| } | ||
| } | ||
|
|
||
|
|
||
| # Password validation | ||
| # https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators | ||
|
|
||
| AUTH_PASSWORD_VALIDATORS = [ | ||
| { | ||
| "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", | ||
| }, | ||
| { | ||
| "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", | ||
| }, | ||
| { | ||
| "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", | ||
| }, | ||
| { | ||
| "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", | ||
| }, | ||
| ] | ||
|
|
||
|
|
||
| # Internationalization | ||
| # https://docs.djangoproject.com/en/4.2/topics/i18n/ | ||
|
|
||
| LANGUAGE_CODE = "en-us" | ||
|
|
||
| TIME_ZONE = "UTC" | ||
|
|
||
| USE_I18N = True | ||
|
|
||
| USE_TZ = True | ||
|
|
||
|
|
||
| # Static files (CSS, JavaScript, Images) | ||
| # https://docs.djangoproject.com/en/4.2/howto/static-files/ | ||
|
|
||
| STATIC_URL = "static/" | ||
| STATIC_ROOT = BASE_DIR / 'staticfiles' | ||
|
|
||
| MEDIA_URL = '/media/' | ||
| MEDIA_ROOT = BASE_DIR / 'media' | ||
|
|
||
| # Default primary key field type | ||
| # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field | ||
|
|
||
| DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
|
|
||
| X_FRAME_OPTIONS = 'SAMEORIGIN' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| from django.contrib import admin | ||
| from django.urls import path, include | ||
| from django.conf import settings | ||
| from django.conf.urls.static import static | ||
|
|
||
| urlpatterns = [ | ||
| path('admin/', admin.site.urls), | ||
| path('summernote/', include('django_summernote.urls')), | ||
| path('news/', include('news.urls')), | ||
| path('contact/', include('contact.urls')), | ||
| path('', include('core.urls')), | ||
| ] | ||
|
|
||
| if settings.DEBUG: | ||
| urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||
| urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| """ | ||
| WSGI config for config project. | ||
| It exposes the WSGI callable as a module-level variable named ``application``. | ||
| For more information on this file, see | ||
| https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ | ||
| """ | ||
|
|
||
| import os | ||
|
|
||
| from django.core.wsgi import get_wsgi_application | ||
|
|
||
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") | ||
|
|
||
| application = get_wsgi_application() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from django.contrib import admin | ||
| from .models import ContactMessage | ||
|
|
||
| @admin.register(ContactMessage) | ||
| class ContactMessageAdmin(admin.ModelAdmin): | ||
| list_display = ('name', 'email', 'subject', 'created_at') | ||
| search_fields = ('name', 'email', 'subject', 'message') | ||
| readonly_fields = ('created_at',) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class ContactConfig(AppConfig): | ||
| default_auto_field = "django.db.models.BigAutoField" | ||
| name = "contact" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from django import forms | ||
| from .models import ContactMessage | ||
|
|
||
| class ContactForm(forms.ModelForm): | ||
| class Meta: | ||
| model = ContactMessage | ||
| fields = ['name', 'email', 'subject', 'message'] | ||
| widgets = { | ||
| 'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Your Name'}), | ||
| 'email': forms.EmailInput(attrs={'class': 'form-control', 'placeholder': 'Your Email'}), | ||
| 'subject': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Subject'}), | ||
| 'message': forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Your Message'}), | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Generated by Django 4.2.28 on 2026-02-16 09:38 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name="ContactMessage", | ||
| fields=[ | ||
| ( | ||
| "id", | ||
| models.BigAutoField( | ||
| auto_created=True, | ||
| primary_key=True, | ||
| serialize=False, | ||
| verbose_name="ID", | ||
| ), | ||
| ), | ||
| ("name", models.CharField(max_length=100)), | ||
| ("email", models.EmailField(max_length=254)), | ||
| ("subject", models.CharField(max_length=200)), | ||
| ("message", models.TextField()), | ||
| ("created_at", models.DateTimeField(auto_now_add=True)), | ||
| ], | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from django.db import models | ||
|
|
||
| class ContactMessage(models.Model): | ||
| name = models.CharField(max_length=100) | ||
| email = models.EmailField() | ||
| subject = models.CharField(max_length=200) | ||
| message = models.TextField() | ||
| created_at = models.DateTimeField(auto_now_add=True) | ||
|
|
||
| def __str__(self): | ||
| return f"{self.name} - {self.subject}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| from django.test import TestCase | ||
| from django.urls import reverse | ||
| from .models import ContactMessage | ||
|
|
||
| class ContactTest(TestCase): | ||
| def test_contact_page_status_code(self): | ||
| response = self.client.get(reverse('contact')) | ||
| self.assertEqual(response.status_code, 200) | ||
|
|
||
| def test_contact_form_submission(self): | ||
| response = self.client.post(reverse('contact'), { | ||
| 'name': 'John Doe', | ||
| 'email': 'john@example.com', | ||
| 'subject': 'Test Subject', | ||
| 'message': 'Test Message' | ||
| }) | ||
| # Check for redirect (success) | ||
| self.assertEqual(response.status_code, 302) | ||
| self.assertTrue(ContactMessage.objects.filter(email='john@example.com').exists()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The settings module commits a fixed
SECRET_KEYvalue, which means anyone who can read the repository can forge Django-signed values (for example session cookies and token signatures) on any deployment that uses this file unchanged. For a production-targeted CMS, this should come from environment/secret management so each environment has a private key.Useful? React with 👍 / 👎.