{"id":20900044,"url":"https://github.com/lennonchin/blogbackendproject","last_synced_at":"2025-04-03T03:13:50.708Z","repository":{"id":27028614,"uuid":"112199498","full_name":"LennonChin/BlogBackendProject","owner":"LennonChin","description":"Backend code for my blogs, develop with Django Rest framework.","archived":false,"fork":false,"pushed_at":"2022-12-08T00:42:35.000Z","size":27400,"stargazers_count":231,"open_issues_count":11,"forks_count":57,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T08:42:47.122Z","etag":null,"topics":["blog","django","django-rest-framework","drf","drf-haystack","editormd","python","rest","rest-api","restful","restful-api","vue","whoosh","xadmin"],"latest_commit_sha":null,"homepage":"https://blog.coderap.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LennonChin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-27T13:26:34.000Z","updated_at":"2025-02-19T15:54:21.000Z","dependencies_parsed_at":"2022-08-29T04:51:19.620Z","dependency_job_id":null,"html_url":"https://github.com/LennonChin/BlogBackendProject","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LennonChin%2FBlogBackendProject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LennonChin%2FBlogBackendProject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LennonChin%2FBlogBackendProject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LennonChin%2FBlogBackendProject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LennonChin","download_url":"https://codeload.github.com/LennonChin/BlogBackendProject/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895796,"owners_count":20851329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blog","django","django-rest-framework","drf","drf-haystack","editormd","python","rest","rest-api","restful","restful-api","vue","whoosh","xadmin"],"created_at":"2024-11-18T11:17:49.516Z","updated_at":"2025-04-03T03:13:50.647Z","avatar_url":"https://github.com/LennonChin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Front and back end of the separation of the blog project - back-end projects\n\nBlog has been online, welcome to browse：[https://blog.coderap.com/](https://blog.coderap.com/)\n\n\u003e [中文版说明](https://github.com/LennonChin/BlogBackendProject/blob/master/README_zh-cn.md)\n\n\u003e This repository stores the backend code for blog entries, built using Django and the Django Rest Framework.\n\n\u003e Note: The front-end code repository linked to this repository is linked here [Blog-Frontend-Project] (https://github.com/LennonChin/Blog-Frontend-Project) and the front-end code is implemented using Vue.js + Vue-Router + iView.js.\n\n## Control Panel effect display\n\n### PC Platform\n\n![Home Page](https://github.com/LennonChin/BlogBackendProject/blob/master/media/PC_1.png)\n\n![Article List Page](https://github.com/LennonChin/BlogBackendProject/blob/master/media/PC_2.png)\n\n![Add Article Page](https://github.com/LennonChin/BlogBackendProject/blob/master/media/PC_3.png)\n\n![Add Article Page](https://github.com/LennonChin/BlogBackendProject/blob/master/media/PC_4.png)\n\n### Mobile Platform\n\n![Mobile effect](https://github.com/LennonChin/BlogBackendProject/blob/master/media/MOBILE_1.png)\n\n## Overall technology stack\n\n1. Python environment: Python 3.6.2\n\n2. Mainly dependent\n\n- [Django==1.10.8](https://github.com/django/django)\n- [djangorestframework==3.6.3](https://github.com/encode/django-rest-framework)\n\n\u003e Note: For more technical stack dependencies, see the `requirements.txt` file\n\n## Implemented basic functions\n\nBack-end project has achieved 19 interfaces, the main function points are as follows:\n\n1. The realization of the three sections: articles, atlas and photography, respectively, corresponding to the three different modes of presentation; at the same time to achieve time-axis archiving section;\n2. Implementation of the management console in the three sections of the article's release, you can publish Markdown format article (using EditorMD editor);\n3 comment function, the current method is to use the nickname + email, the first comment will verify the mailbox (by sending a verification code);\n4. Achieve the article encryption function;\n5. Implementation of the seven cattle cloud storage services docking, publishing reviews and other operations will upload the image data to the seven Niuniu; currently does not provide the corresponding services within the project, such as the need to docking please buy seven Niuniu storage object services;\n\n\u003e Note: The xadmin, EditorMD and other plug-ins used in the project are developed for the second time. In order to cooperate with the project-specific functions, please do not change the plug-in easily.\n\n## Next will be achieved\n\n1. Access GitHub, WeChat, Weibo, Facebook and other third-party login comments.\n2. Add more columns.\n\n## How to use\n\n1. Clone this project\n2. local installation of Python3 and pip environment;\n3. After installing the virtualenv and virtualenvwrapper environment, execute the following command to create a virtual environment:\n\n```bash\n# Create a workspace\n\u003e mkvirtualenv BlogBackend\n# Activate the workspace\n\u003e workon BlogBackend\n# Change to the root directory of this project, Install dependencies\n\u003e pip install -r requirements.txt\n```\n\n4. Next, if you are using PyCharm as a development environment, modify its Project Interpreter to workspace we made above.\n5. In this project, sensitive account information is not provided, but stored in `private.py` file, this file is not managed to the warehouse, so you need to create a `private.py` file in the same level `setting.py` file Document, which reads as follows:\n\n```python\n#! / usr / bin / python3\n# - * - coding: utf-8 - * -\n# @Time: 2017/12/29 6:01 PM\n# @Author: LennonChin\n# @Email: i@coderap.com\n# @File: private.py\n# @Software: PyCharm\n\n# Site Secret Key，it is a copy of settings.py file's SECRET_KEY option\nPRIVATE_SECRET_KEY = ''\n\n# Database connection configuration\nDATABASE_CONFIG = {\n    'ENGINE': '', # Database Engine\n    'NAME': '', # database name used in the database\n    \"USER\": '', # database user name\n    \"PASSWORD\": '', # database password\n    \"HOST\": '', # database address\n    'PORT': 3306, # database access port，MySQL is 3306 default\n    'OPTIONS': {\n        \"init_command\": \"SET default_storage_engine = INNODB;\",\n    }\n}\n\n# Send mail server configuration\nEMAIL_CONFIG = {\n    'EMAIL_HOST': \"\", # mail server address\n    'EMAIL_PORT': 25, # mail server port, usually 25\n    'EMAIL_HOST_USER': \"\", # mail server account\n    'EMAIL_HOST_PASSWORD': \"\", # mail server password\n    'EMAIL_USE_TLS': False, # Whether to use TLS encryption connection, generally not used\n    'EMAIL_FROM': \"\" # This item is generally the same as EMAIL_HOST\n}\n\n# Qiniu Yun related configuration\nPRIVATE_QINIU_ACCESS_KEY = '' # Qiniu Access key\nPRIVATE_QINIU_SECRET_KEY = '' # Qiniu Secret key\nPRIVATE_QINIU_BUCKET_DOMAIN = '' # Qiniu Bucket domain\nPRIVATE_QINIU_BUCKET_NAME = '' # Qiniu name\n\nPRIVATE_MEDIA_URL_PREFIX = '' # Resource prefix used when accessing Cattle Cloud\nPRIVATE_SITE_BASE_URL = '' # Site URL, for example as you site access domain\n```\n\nThe `SECRET_KEY`(`PRIVATE_SECRET_KEY`)above is a key that generated by django, we can also generate it by myself, generate way as follow:\n\n```python\nIn [1]: from django.core.management import utils\n\nIn [2]: utils.get_random_secret_key()\nOut[2]: '7%x-f2u#@q@ar$q(=_yauzx8i4$8u\u00265epa=w^tjfo@-mp3+!r1'\n```\n\n`SECRET_KEY` is auto generated by django when we start a project, the way use code above, you can read the source code for details.\n\n6. Configure the above configs, use the following command to migrate the table:\n\n```bash\n\u003e python manage.py makemigrations\n\u003e python manage.py migrate\n```\n\n\u003e Note: If the migration fails, you can migrate by user, material, base, user_operation, index and remaining modules in that order.\n\n7. Then start the project directly use the following command:\n\n```python\n\u003e python manage.py runserver 127.0.0.1:8000\n```\n\nBy default, if you run the evelopment Server after running '127.0.0.1: 8000`, the provided interface is at http://127.0.0.1:8000/api`, background management address `http://127.0.0.1: 8000/xadmin`.\n\nAt the same time, if you want the front-end to access the back-end interface, you need to fill in the site information in the back-end of the basic configuration - Web site configuration, the most important thing is to fill in the `API interface BaseURL` entry for your front-end page to access the interface API.\n\n## Others\n\nIn this project, I use `Pygments` and `pymdownx` to process markdown convert, and I expand these two third-party plugins, the expanded code saved at path `apps/utils/HTMLFormatter`, and there is a test file you can experiment. If you want to use these two super expandations, you need two steps. First, copy `superfences.py`、`highlight.py` to your project virtual environment, overwrite the file of pymdownx, just as my project virtual environment named `BlogBackend`, and it's path is `virtualEnvs/BlogBackend/lib/python3.6/site-packages/pymdownx`. Then you need to rename `apps/utils/HTMLFormatter/code.py` to `apps/utils/HTMLFormatter/html.py` in these project, and copy the renamed file to your project virtual environment, overwrite the source code files of pygments, just as the path of my project's virtual environment is `virtualEnvs/BlogBackend/lib/python3.6/site-packages/pygments/formatters`.\n\nIf you feel the steps above is complex, you can also run project directly, but cannot use the expanded markdown convert syntaxes, example page: [Expand Markdown syntax of this website](https://blog.coderap.com/article/4 \"Expand Markdown syntax of this website\").\n\n## License\n\n[Apache-2.0] (https://opensource.org/licenses/Apache-2.0)\n\nCopyright (c) 2016-present, LennonChin","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flennonchin%2Fblogbackendproject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flennonchin%2Fblogbackendproject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flennonchin%2Fblogbackendproject/lists"}