Skip to content

Commit e8a2c9c

Browse files
committed
Organize settings
1 parent 77841f3 commit e8a2c9c

13 files changed

Lines changed: 136 additions & 136 deletions

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ __pycache__/
66
.venv/
77
venv/
88
.env
9+
celerybeat-schedule*
910
db.sqlite3
1011
staticfiles/
1112

‎celerybeat-schedule‎

0 Bytes
Binary file not shown.

‎celerybeat-schedule-shm‎

-32 KB
Binary file not shown.

‎celerybeat-schedule-wal‎

-88.5 KB
Binary file not shown.

‎docker-compose.yml‎

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
x-app-common: &app-common
22
image: newsletter-maker-app:dev
33
pull_policy: never
4+
build:
5+
context: .
6+
dockerfile: docker/web/Dockerfile
47
env_file:
58
- .env
6-
environment:
7-
DATABASE_URL: postgresql://newsletter:newsletter@postgres:5432/newsletter_maker
8-
REDIS_URL: redis://redis:6379/0
9-
QDRANT_URL: http://qdrant:6333
109
volumes:
1110
- .:/app
1211
- static_data:/app/staticfiles
1312

13+
x-shared-env: &shared-env
14+
DATABASE_URL: postgresql://newsletter:newsletter@postgres:5432/newsletter_maker
15+
REDIS_URL: redis://redis:6379/0
16+
QDRANT_URL: http://qdrant:6333
17+
1418
services:
1519
django:
1620
<<: *app-common
17-
build:
18-
context: .
19-
dockerfile: docker/web/Dockerfile
2021
environment:
2122
BOOTSTRAP_APP: "true"
22-
DATABASE_URL: postgresql://newsletter:newsletter@postgres:5432/newsletter_maker
23-
REDIS_URL: redis://redis:6379/0
24-
QDRANT_URL: http://qdrant:6333
23+
<<: *shared-env
2524
command: ["gunicorn", "newsletter_maker.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "2"]
2625
depends_on:
2726
postgres:
@@ -40,9 +39,7 @@ services:
4039
<<: *app-common
4140
environment:
4241
BOOTSTRAP_APP: "false"
43-
DATABASE_URL: postgresql://newsletter:newsletter@postgres:5432/newsletter_maker
44-
REDIS_URL: redis://redis:6379/0
45-
QDRANT_URL: http://qdrant:6333
42+
<<: *shared-env
4643
command: ["celery", "-A", "newsletter_maker", "worker", "--loglevel=info"]
4744
depends_on:
4845
postgres:
@@ -54,9 +51,7 @@ services:
5451
<<: *app-common
5552
environment:
5653
BOOTSTRAP_APP: "false"
57-
DATABASE_URL: postgresql://newsletter:newsletter@postgres:5432/newsletter_maker
58-
REDIS_URL: redis://redis:6379/0
59-
QDRANT_URL: http://qdrant:6333
54+
<<: *shared-env
6055
command: ["celery", "-A", "newsletter_maker", "beat", "--loglevel=info"]
6156
depends_on:
6257
postgres:

‎docs/FILES.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# File Organization
2+
3+
In Django, you have one **project** (the container for your settings and main routing) and one or more **apps** (reusable modules that handle specific logic).
4+
5+
## File Breakdown: `newsletter_maker/` (The Project)
6+
7+
This is the "brain." It contains your global settings, main URL configuration, and WSGI/ASGI entry points for the server.
8+
9+
- **`settings.py`**: All configuration (Database URLs, installed apps, Celery broker settings).
10+
- **`urls.py`**: The "main" URL file that imports the `api_urls.py` and `core.urls`.
11+
- **`wsgi.py` / `asgi.py`**: The interface Gunicorn uses to run your app.
12+
- **`celery.py`**: Where Celery is initialized for the project.
13+
14+
## File Breakdown: `core/` (The Application)
15+
16+
This is where the actual "features" live. Django encourages putting logic into apps so you could, in theory, pluck this `core` folder out and drop it into a different project.
17+
18+
- **`models.py`**: The most important file. It defines your database schema using Python classes.
19+
- **`serializers.py`**: Part of **DRF** (Django REST Framework). It converts your `models.py` data into JSON for the API.
20+
- **`tasks.py`**: Contains your **Celery** background tasks (e.g., the actual code that sends the newsletter).
21+
- **`api.py` & `api_urls.py`**: These likely house your DRF logic (ViewSets) and the specific URL paths for your API endpoints.
22+
- **`admin.py`**: Configures how your models look in the built-in Django `/admin` interface.
23+
- **`views.py` & `urls.py`**: Handle standard web requests and map them to templates.
24+
- **`embeddings.py`**: Likely a custom file for your specific app (given the `qdrant` service you have), probably handling Vector Search or AI logic.
25+
- **`migrations/`**: A history of your database changes.
26+
- **`templates/` & `static/`**: Your HTML files and CSS/JS/images.
27+
- **`management/`**: Contains custom terminal commands (e.g., `python manage.py my_custom_command`).
28+
- **`tests.py`**: Where your automated tests live.

‎docs/NOTES.md‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,3 @@ If your primary bottleneck is the time spent reading 50 articles to find the 5 t
114114
- **Make.com:** Visual AI workflow automation platform. You can build a scenario that watches your RSS feeds and social mentions, sends them to **OpenAI/Claude** to generate a 2-sentence summary and a "relevance score," and then dumps the winners into a **Notion** board or **Airtable** for your final review.
115115

116116
- **n8n**: A low-code tool frequently used to build custom newsletter summarizers. You can create a workflow that monitors your RSS feeds, sends new content to an LLM (like GPT-4 or Claude) for a technical summary, and stores the results in a JSON file or Airtable.
117-
118-
## Containers
119-
120-
celery-beat
121-
celery-worker
122-
django
123-
nginx
124-
postgres
125-
qdrant
126-
redis
127-
128-
newsletter-maker

‎generate_icon.py‎

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .base import * # noqa: F403
2+
from .ai import * # noqa: F403
3+
from .celery import * # noqa: F403
4+
from .logging import * # noqa: F403

‎newsletter_maker/settings/ai.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
3+
from .base import env_bool
4+
5+
6+
QDRANT_URL = os.getenv("QDRANT_URL", "http://qdrant:6333")
7+
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY", "")
8+
OPENROUTER_API_BASE = os.getenv("OPENROUTER_API_BASE", "https://openrouter.ai/api/v1")
9+
OPENROUTER_APP_URL = os.getenv("OPENROUTER_APP_URL", "")
10+
OPENROUTER_APP_NAME = os.getenv("OPENROUTER_APP_NAME", "newsletter-maker")
11+
EMBEDDING_PROVIDER = os.getenv("EMBEDDING_PROVIDER", "sentence-transformers")
12+
EMBEDDING_MODEL = os.getenv("EMBEDDING_MODEL", "sentence-transformers/all-MiniLM-L6-v2")
13+
EMBEDDING_TRUST_REMOTE_CODE = env_bool("EMBEDDING_TRUST_REMOTE_CODE", default=False)
14+
OLLAMA_URL = os.getenv("OLLAMA_URL", "http://localhost:11434")

0 commit comments

Comments
 (0)