Istar is a Django web application for anonymous social posting, school timetable management. It includes a low-friction social feed, asynchronous voting, user bookmarks, and a timetable processing engine (tkb) that parses scheduling data from Chuyen Ha Tinh High School (Trường THPT Chuyên Hà Tĩnh, Vietnam).
- Core architecture and applications
- Key features
- Database schema and relations
- Tech stack and dependencies
- Installation and local setup
- Deployment configuration
The project uses a modular Django application structure:
Dtest/: The core project configuration directory containing routing (urls.py), ASGI/WSGI definitions, and settings (settings.py). The timezone is set toAsia/Ho_Chi_Minh.authenticate/: Handles user accounts, profile pages, and authentication security. It replaces the default Django admin registration, login, and password change templates, and includes a server-side paginated member portal.post/: Handles social posts. Implements CRUD operations for posts, asynchronous voting, and user bookmarks.tkb/(Thời khóa biểu): Contains the timetable extractor. It uses backend parsers (TKBapi.py) to process and display real-time timetable updates based on school schedules.homepage/: Handles the landing page, routing, and general application descriptions.
- Account creation uses
UserCreationFormwithout immediate email verification to simplify onboarding. - The profile directory uses server-side pagination (
django.core.paginator) limited to 10 profiles per page, displaying group indicators for administrators and staff. - Public profiles display a feed of the user's posts, using optimized database subqueries (
CoalesceandSubquery) to avoid performance bottlenecks.
- Upvotes and downvotes use AJAX
fetch()requests to update post scores instantly without reloading the page. - Client-side JavaScript measures the rendered height of long posts and appends a "See more..." toggle if the text overflows the layout bounds.
- Feeds can be filtered by time ranges (day, week, month) using
timedeltaconstraints, sorted by a combination of upvote counts and post age. - Users can save posts to a private bookmarks list, tracked via database annotations.
- A backend script parses school schedule updates using
requestsandlxml. - The parsed schedule dynamically updates user timetable grids to match changes at Chuyen Ha Tinh High School.
The application uses SQLite for development, extending Django's built-in contrib.auth.models.User model.
+-------------------+ +-------------------+
| auth.User | <----------+ | Post |
+-------------------+ +-------------------+
| ^ | ^
| id | author | id | post
v | v |
+-------------------+ +-------------------+
| Vote | | Bookmark |
+-------------------+ +-------------------+
| user (FK) | | user (FK) |
| post (FK) | | post (FK) |
| voteType (Str) | | created_at (DT) |
+-------------------+ +-------------------+
Post:title: ACharFieldlimited to 255 characters.body: ATextFieldfor post content.author: A foreign key toauth.Userwithmodels.CASCADEdeletion.date: An automatically populatedDateTimeField(auto_now_add=True).
Vote:- Enforces a unique constraint via
unique_together = ('user', 'post'). voteType: A choice field limited toupordownto prevent duplicate voting.
- Enforces a unique constraint via
Bookmark:- Enforces a unique constraint via
unique_together = ('user', 'post'). created_at: ADateTimeFieldtracking when the post was saved.
- Enforces a unique constraint via
The project relies on specific versions of the following packages:
Django==3.2.19 # Web framework core
pandas==2.3.2 # Data alignment for parsing timetables
numpy==2.3.2 # Numerical computing support
openpyxl==3.1.5 # Excel file parsing
lxml==6.0.1 # XML and HTML parsing
requests==2.32.5 # HTTP client for downloading schedules
gunicorn==23.0.0 # WSGI HTTP server for production
asgiref==3.6.0 # Async/sync compatibility layer
sqlparse==0.4.2 # SQL parsing and formatting
Ensure Python 3.8+ is installed. Clone the repository and initialize a virtual environment:
python3 -m venv venv
# Linux/macOS
source venv/bin/activate
# Windows CMD
venv\Scripts\activate.batInstall the required packages:
pip install --upgrade pip
pip install -r requirements.txtSet up the database schema:
python manage.py makemigrations
python manage.py migrateCreate a superuser to access the Django admin panel:
python manage.py createsuperuserRun the local Django server:
python manage.py runserverOpen http://127.0.0.1:8000/ in a web browser.
To run the application via Gunicorn in a production environment:
gunicorn Dtest.wsgi:application --bind 0.0.0.0:8000 --workers 3Compile static assets into a single directory before deployment:
python manage.py collectstatic --noinputAssets are gathered into the staticfiles/ directory as specified in Dtest/settings.py.