View the live website here.
Welcome to the LangCorrect repository! This community-driven platform is designed to help users master writing in foreign languages. Ideal for language learners in search of practice and native speakers willing to lend a hand, LangCorrect offers a friendly, engaging environment where you can connect, share, and learn.
This repository houses the source code for the LangCorrect web application, developed using Django for the backend and the Django templating engine for the frontend. Additionally, a React client is currently in development; you can access its repository by clicking on LangCorrect React Client.
Interested in the features we offer or looking to contribute? Read on to find out more.
- User Registration and Authentication
- Profile Customization
- Multi-language Support
- Post Creation and Management
- Peer Review and Corrections
- Automatic Correction Syntax Highlighting
- Site and Email Notifications
- Writing Prompts
- Challenges
- Follow and Unfollow Users
- Stripe Checkout Integration
- Premium Subscription for Advanced Features
- Upload images through Local Media Storage or S3
Note: This is not an exhaustive list of features. LangCorrect is continually evolving, and new features are being added regularly.
- Django 4.x
- Python 3.x
- Bootstrap CSS
- HTMX
- JavaScript
- PostgreSQL
- Redis
- Celery
- SendGrid
- Stripe
- Sentry
- AWS S3 (Optional)
- CI/CD (GitHub Actions, GitLab CI, etc.)
langcorrect/ - Project-specific code
constants/ - Project-wide constants
helpers/ - Project-wide helpers
templates/ - All project templates
static/ - All project static files
<app>/ - Specific app folders
constants/ - App-specific constants
helpers/ - App-specific helpers
api/ - wip App-specific API files
- Update DB Schema for more efficient queries and organization
- Migrate data and codebase to use new DB schema
- [] Release API
- [] Release Next.js client
- [] Release Messenger
- [] Remove deprecated project templates
- [] Containerize project (again...)
- [] Work on getting test coverage ~80%
- PostgreSQL; refer to the official documentation for installation.
- Pre-commit; refer to the official documentation for the pre-commit.
- Cookiecutter; refer to the official GitHub repository of Cookiecutter
git clone [email protected]:LangCorrect/server.git
python3 -m venv venv
source venv/bin/activate
pip install -r requirements/local.txt
We use Fugashi and NLTK for text parsing. Fugashi parses Japanese text and NLTK parses text in various languages.
python -m unidic download
python -m nltk.downloader popular
psql
CREATE DATABASE langcorrect;
python manage.py migrate
Make sure to setup pre-commit, otherwise there will be a bunch of CI and Linter errors.
pre-commit install
python manage.py loaddata fixtures/languages.json
python manage.py loaddata fixtures/correction_types.json
python manage.py runserver
The site will be accessible via http://localhost:8000.
Note: User registrations require email confirmations. Check your terminal for this link!
celery -A config.celery_app worker --loglevel=info
stripe listen --forward-to localhost:8000/subscriptions/webhook/
This project was started with Cookiecutter Django. To see a table of configurable settings visit settings.
This project uses several tools to maintain code quality. Below are the commands to run these tools.
We use flake8
for checking Python code for style and syntax errors and pylint
for additional code analysis.
- Run
flake8
to check the entire project for PEP8 compliance - Run
pylint <python files that you wish to lint>
to perform static code analysis
This project uses the Pytest, a framework for easily building simple and scalable tests.
python manage.py pytest #runs all tests
python manage.py pytest langcorrect/<app> #test specific app
You should build your tests to provide the highest level of code coverage. You can run the pytest with code coverage by typing in the following command:
python manage.py coverage run -m pytest
python manage.py coverage report
python manage.py test
stripe listen --forward-to localhost:8000/subscriptions/webhook/
This app utilizes Celery as an asynchronous task queue to efficiently manage background tasks, such as updating user rankings and running periodic tasks via the Beat scheduler.
To run a celery worker:
cd langcorrect
celery -A config.celery_app worker -l info
Please note: For Celery's import magic to work, it is important where the celery commands are run. If you are in the same folder with manage.py, you should be right.
To run periodic tasks, you'll need to start the celery beat scheduler service. You can start it as a standalone process:
cd langcorrect
celery -A config.celery_app beat
or you can embed the beat service inside a worker with the -B
option (not recommended for production use):
cd langcorrect
celery -A config.celery_app worker -B -l info
Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself. The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.
You must set the DSN url in production.
We welcome contributions from everyone, whether you are a seasoned programmer or a first-timer. Below are the steps and guidelines you should follow to contribute to this project.
Please make sure that you have:
- Set up the project and have it running locally. Follow the instructions in the Getting Started section.
- Familiarized yourself with our Code of Conduct (TBD).
Contribution Workflow:
- Find an Issue: Browse the open issues and comment on one expressing your intent to work on that issue.
- New Issue: If you've found a new issue or have a new feature to suggest, create a new issue to report it.
- Fork & Clone: Fork the project to your own GitHub account, and clone it to your local machine.
- Create a Feature Branch: Create a new branch named after the issue you are solving, Prefix the branch name with the issue number:
git checkout -b 154-fixing-some-issue
. - Make Changes: Implement your changes.
- Run pre-commit Checks: Before commiting, run pre-commit checks to ensure code style and quality:
pre-commit
. - Commit Changes: Commit your changes with a meaningful commit message, referencing the issue number:
git commit -m "Add meaningful description here (#154)"
- Push Changes: Push your changes.
- Open Pull Request: Open a PR in the original repository and fill in the PR template.
- Address Reviews: Maintainers will review your PR. Make any requested changes if needed.
If you have any questions or need further clarification on any of the steps, feel free to reach out to our Discord: https://discord.gg/Vk7KcV26Fe.
We look forward to your contributions!