An app that can create blogs. The main purpose to create this app to practice django skills and make the source code available online for other developers to start this repo for their own custom need
Using this app, you can
- create an account, update the user password, login to the website
- fetch the user detail using API
- create a token for API validation
- localization has been implementated for english and chinese languages. You can pass a get params lang=en|zh
- create, update a post. Every post require admin approval
- every post can be bookmark/unbookmark on user request
- On updating the password, system will fire an email to the related user. You need to make sure all the settings are properly setup in settings.py and .env files. If you want to skip sending the email, make sure to set EMAIL_HOST_EXIST as None. No further changes are required.
- install anaconda
- create an environment using
conda create -n "django-blog-posts" python=3.10
- run
conda activate django-blog-posts
- run
pip install -r requirements.txt
- replace file name in blog_posts/copy_settings.py to settings.py
- you need to setup database(mysql) in
.env
file. Just replace .env.backup to .env and add db credentials - install
redis
and change your server path in.env
file - create a database
django_blog_posts
in the database - run migrations using
python manage.py migrate
- run
python manage.py runserver 0.0.0.0:8080
- you may refer to deployment.yml file in github Action for deployment
- refer to deployment_using_uwsgi for deploying using uwsgi
- refer to deployment using gunicorn for deploying using gunicorn
- run command
docker-compose up
For reference check DockerFile and docker-compose.yml
- install gettext. follow django documentation or Google it
- following commands can be handy while creating locationlization
- run
django-admin makemessages --locale=zh --extension=html,txt,py
- run
django-admin compilemessages
- super user credentials: username: test_user password:test_user
You can refer to this path for next js Last but not least, don't forget to our website
- custom middleware has been created for language translation
middlewares.LanguageTransMiddleware
- django session and token validation has been implemented
- front end has been developed using Jquery & Bootstrap
Postman collection has been made online for public use
- django custom template tags and filter
- Serializer, form validation have been implemented
Postgre support is included. You need to change the credentials in settings.py
- we have set postgre database as default database. if you are curious to change it to mysql. change replace default1 key with default in settings.py
To deploy using Nginx and uwsgi, please refer to following link
you may refer to fast_api for all API ends point.
Further Do not forget to check the swagger documentation by visiting the
** your_server/docs **
For deployment of Fast APi using gunicorn,uvicorn,hypervisor and nginx Please refer to this
python manage.py migrate
python manage.py runserver
python manage.py collectstatic
docker exec -it blog_post /bin/bash
conda activate django-blog-posts
pip list
python manage.py test
- to app specific test cases,Run
python manage.py test auths
- to tag specific test cases, run. Two tags are used in the project
slow
andfast
python manage.py test --tags=slow
CREATE USER 'root2'@'localhost' IDENTIFIED BY 'root2';
GRANT ALL PRIVILEGES ON * . * TO 'root2'@'localhost';
FLUSH PRIVILEGES;
You can open this to check deployment on Amazon Elastic Beanstalk. For source code, Please open me
- https://django.lyskills.com
- https://test-django.lyskills.com
- https://fastapi.lyskills.com
- https://flask.lyskills.com
- https://ec2-user-django.lyskills.com
- http://dev-web-django.eba-ch3dwa3n.us-east-1.elasticbeanstalk.com
- http://web-django.eba-ch3dwa3n.us-east-1.elasticbeanstalk.com/
- https://nextjs.lyskills.com