|
| 1 | +# Simple Docs Clone — Django Beginner Project |
| 2 | + |
| 3 | +A beginner-friendly Django project that serves a single-page, offline-capable text editor similar to Google Docs. The editor is powered by Quill.js and saves everything to your browser's localStorage. No database is used for documents. |
| 4 | + |
| 5 | +## Features |
| 6 | +- Rich-text editor (bold, italic, underline, strikethrough, headings, size, color, lists, blockquote, code, links, images, undo/redo) |
| 7 | +- Editable document title |
| 8 | +- Autosave to localStorage every 5 seconds and on blur/unload |
| 9 | +- File operations: New, Import (HTML/JSON), Save HTML, Export Markdown, Export PDF, Clear Local Data |
| 10 | +- Live word and character count |
| 11 | +- Responsive, clean UI similar to Google Docs |
| 12 | +- Light/Dark theme with persistence |
| 13 | +- Optional version snapshots (keeps 3 previous saves) with restore |
| 14 | + |
| 15 | +## Tech Stack |
| 16 | +- Python 3.11 |
| 17 | +- Django 4.2 |
| 18 | +- SQLite (default, unused) |
| 19 | +- HTML5, CSS3, JavaScript (ES6) |
| 20 | +- Frontend via CDN: Quill.js, Turndown.js, html2pdf.js, FontAwesome, Google Fonts (Inter) |
| 21 | + |
| 22 | +## Project Structure |
| 23 | +``` |
| 24 | +django_google_doc_clone/ |
| 25 | +├─ manage.py |
| 26 | +├─ requirements.txt |
| 27 | +├─ README.md |
| 28 | +├─ LICENSE |
| 29 | +├─ django_google_doc_clone/ |
| 30 | +│ ├─ __init__.py |
| 31 | +│ ├─ settings.py |
| 32 | +│ ├─ urls.py |
| 33 | +│ ├─ wsgi.py |
| 34 | +│ └─ asgi.py |
| 35 | +└─ editor/ |
| 36 | + ├─ __init__.py |
| 37 | + ├─ views.py |
| 38 | + ├─ urls.py |
| 39 | + ├─ templates/ |
| 40 | + │ └─ editor/ |
| 41 | + │ └─ index.html |
| 42 | + └─ static/ |
| 43 | + └─ editor/ |
| 44 | + ├─ css/ |
| 45 | + │ └─ styles.css |
| 46 | + ├─ js/ |
| 47 | + │ └─ app.js |
| 48 | + └─ favicon.svg |
| 49 | +``` |
| 50 | + |
| 51 | +## Setup |
| 52 | + |
| 53 | +Linux/macOS (bash): |
| 54 | +``` |
| 55 | +python -m venv .venv && source .venv/bin/activate |
| 56 | +pip install -r requirements.txt |
| 57 | +python manage.py runserver |
| 58 | +``` |
| 59 | + |
| 60 | +Windows (PowerShell): |
| 61 | +``` |
| 62 | +python -m venv .venv |
| 63 | +.\.venv\Scripts\Activate.ps1 |
| 64 | +pip install -r requirements.txt |
| 65 | +python manage.py runserver |
| 66 | +``` |
| 67 | + |
| 68 | +Open the app at: http://127.0.0.1:8000/ |
| 69 | + |
| 70 | +## Using the Editor |
| 71 | +- Title: Click the title at the top to edit. |
| 72 | +- Toolbar: Use the toolbar for formatting (bold, italic, etc.). |
| 73 | +- Autosave: Content and title autosave every 5 seconds and on leaving the page. |
| 74 | +- New: Clears the current document (keeps theme and snapshots). |
| 75 | +- Import: Load an HTML or JSON file. JSON can be a raw Quill Delta or an object with `{ delta, title }`. |
| 76 | +- Save HTML: Downloads a self-contained HTML file with embedded styles. |
| 77 | +- Export Markdown: Converts the current document to .md using Turndown. |
| 78 | +- Export PDF: Creates a PDF via html2pdf.js. |
| 79 | +- Clear Local Data: Removes saved content, title, and snapshots from localStorage. |
| 80 | +- Versions: Keeps the last 3 autosave snapshots. Select one and Restore. |
| 81 | + |
| 82 | +## Deployment |
| 83 | +- Render or PythonAnywhere: Deploy this Django app as usual. Since all logic is client-side, no DB setup is required beyond Django defaults. |
| 84 | +- GitHub Pages: The editor is a static page at `editor/templates/editor/index.html` using static assets at `editor/static/editor/`. You can host it as a pure static site by copying `index.html` and the `static/editor` folder to a static hosting location and replacing `{% load static %}` and `{% static ... %}` with plain relative paths. |
| 85 | + |
| 86 | +## Contributing |
| 87 | +Contributions are welcome! Please fork the repo, create a feature branch, and open a pull request. Beginner-friendly issues are encouraged for Hacktoberfest. |
| 88 | + |
| 89 | +## License |
| 90 | +MIT License — see LICENSE for details. |
0 commit comments