Skip to content

This is my Portfolio's backend repository, using the python based flask framework

License

Notifications You must be signed in to change notification settings

Chenmo1212/homepage_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Homepage back-end

GitHub Workflow Status GitHub repo size Issues GitHub pull requests Visitor GitHub

GitHub followers GitHub forks GitHub stars GitHub watchers

Description

This is my Portfolio's back-end repository, using the python based flask framework.

You can check my Portfolio here.

REST API

The project follows the REST API architectural style, providing endpoints for various operations.

  • GET /messages: Retrieves a list of messages for guests.
  • POST /messages: Adds a new message.
  • GET /admin/messages: Retrieves a list of messages for administration.
  • PUT /admin/messages/{messageId}/status: Updates the status of a message.
  • DELETE /admin/messages/{messageId}: Deletes a message.
  • jPOST /admin/messages/delete: Deletes multiple messages based on the provided list of IDs.

Wechat Notification

This project used the enterprise WeChat application to send notifications to WeChat in real time. When a guest sends a new message, a enterprise WeChat notification will be sent. In the environment variables below, CORPID, AGENTID, CORPSECRET and ADMINURL are environment variables related to enterprise WeChat notifications. If you don’t need them, just comment them out.

Api test

This project used pytest as the api testing framework, and created a test_api.py file in the root directory.

All interfaces can be tested with the following command:

pytest test_api.py

Installation

  1. Clone the repository:

    git clone https://github.com/Chenmo1212/homepage_backend.git
  2. Navigate to the project directory:

    cd your-repository
  3. Create virtual environment:

    python -m venv venv
  4. Install the dependencies after entering the virtual environment just created:

    pip install -r requirements.txt
  5. Set up the environment variables:

    • Create a .env file in the project root directory.

    • Add the following environment variables:

      FLASK_ENV=development
      CORPID=your-corporate-id
      AGENTID=your-agent-id
      CORPSECRET=your-corporate-secret
      ADMINURL=https://xxxxxxx
      
  6. Set up the configure file for development environment:

    • Create a config_development.py file in the project root directory.

    • Add the following variables:

      MONGO_URI=your-mongodb-uri
  7. Run the application:

    flask run

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue if you find a bug or have a suggestion for a new feature.

License

This project is licensed under the MIT License.

About

This is my Portfolio's backend repository, using the python based flask framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages