Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
pull-requests: write
issues: read
id-token: write

Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ services:
expose:
- 8000
environment:
SECRET_KEY: ${SECRET_KEY} # Loaded from .env file
SECRET_KEY: ${SECRET_KEY} # Loaded from .env file
DEBUG: ${DEBUG:-False}
ALLOWED_HOSTS: ${ALLOWED_HOSTS:-localhost,127.0.0.1}
# Prefer passing through DATABASE_URL from .env to avoid duplication
DATABASE_URL: ${DATABASE_URL}
# Use a single REDIS_URL derived from REDIS_PASSWORD for consistency
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
# Use REDIS_URL from environment so encoded passwords stay intact
REDIS_URL: ${REDIS_URL}
DJANGO_SETTINGS_MODULE: techblog_cms.settings
PYTHONPATH: /app
DJANGO_ENV: production
Expand Down
6 changes: 6 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def main():
print("Hello from techblog-cms!")


if __name__ == "__main__":
main()
14 changes: 0 additions & 14 deletions nginx/ssl/README

This file was deleted.

33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[project]
name = "techblog-cms"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"black>=23.12,<24.0",
"django==4.2.10",
"django-compressor>=4.4,<5.0",
"django-cors-headers>=4.3,<5.0",
"django-csp>=3.7,<4.0",
"django-extensions>=3.2,<4.0",
"django-redis>=5.4,<6.0",
"flake8>=6.1,<7.0",
"gunicorn>=21.2,<22.0",
"isort>=5.13,<6.0",
"linkify-it-py>=2.0,<3.0",
"markdown>=3.5,<4.0",
"pillow>=10.0,<11.0",
"playwright>=1.40,<2.0",
"psycopg2-binary>=2.9,<3.0",
"pygments>=2.15,<3.0",
"pytest>=7.4,<8.0",
"pytest-cov>=4.1,<5.0",
"pytest-django>=4.7,<5.0",
"python-decouple>=3.8,<4.0",
"redis>=5.0,<6.0",
"requests>=2.31,<3.0",
"ruff>=0.13.0",
"sentry-sdk>=1.39,<2.0",
"whitenoise>=6.5,<7.0",
]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ isort>=5.13,<6.0

# Documentation
markdown>=3.5,<4.0
pymdown-extensions>=10.8,<11.0
linkify-it-py>=2.0,<3.0

# Optional: Image processing
Expand Down
51 changes: 0 additions & 51 deletions techblog_cms/migrations/0001_initial.py

This file was deleted.

Empty file.
2 changes: 1 addition & 1 deletion techblog_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
# Cache Configuration
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': config('REDIS_URL', default='redis://redis:6379/1'),
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
Expand Down
66 changes: 45 additions & 21 deletions techblog_cms/templatetags/markdown_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,53 @@

register = template.Library()


def _resolve_linkify_extension():
"""Return a linkify extension instance if one is available."""
try:
from markdown.extensions.linkify import LinkifyExtension

return LinkifyExtension()
except ImportError:
try:
from pymdownx.magiclink import MagiclinkExtension

# Magiclink provides linkify behaviour when Markdown's native
# extension is unavailable.
return MagiclinkExtension()
except ImportError:
return None


@register.filter
def markdown_to_html(text):
"""
Convert markdown text to HTML
"""
"""Convert markdown text to HTML with optional auto-linking."""
if not text:
return ''

# Convert markdown to HTML with Pygments for syntax highlighting
html = markdown.markdown(text, extensions=[
'extra', # Extra features like tables, footnotes, and raw HTML
'codehilite', # Code highlighting with Pygments
'toc', # Table of contents
'fenced_code', # Fenced code blocks
'nl2br', # Convert newlines to <br>
'markdown.extensions.linkify', # Auto-link plain URLs
], extension_configs={
'codehilite': {
'linenums': False, # Disable line numbers
'guess_lang': True, # Guess language if not specified
'css_class': 'highlight', # CSS class for code blocks
'pygments_style': 'github-dark', # Use GitHub-like dark theme
}
})
return ""

extensions = [
"extra", # Extra features like tables, footnotes, and raw HTML
"codehilite", # Code highlighting with Pygments
"toc", # Table of contents
"fenced_code", # Fenced code blocks
"nl2br", # Convert newlines to <br>
]

linkify_extension = _resolve_linkify_extension()
if linkify_extension:
extensions.append(linkify_extension)

html = markdown.markdown(
text,
extensions=extensions,
extension_configs={
"codehilite": {
"linenums": False, # Disable line numbers
"guess_lang": True, # Guess language if not specified
"css_class": "highlight", # CSS class for code blocks
"pygments_style": "github-dark", # Use GitHub-like dark theme
}
},
)

return mark_safe(html)
Loading
Loading