database-project

  • r7_899607
    了解作者
  • 8.4MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-25 14:21
    上传日期
瓶底 具有样板代码的Flask应用程序模板已为您完成。 可从获得文档。 包括什么? 蓝图 用户和权限管理 用于数据库的Flask-SQLAlchemy 表格的Flask-WTF 用于资产管理和SCSS编译的Flask-Assets 烧瓶邮件发送电子邮件 gzip压缩 Redis Queue用于处理异步任务 ZXCVBN密码强度检查器 CKEditor用于编辑页面 演示版 主页: 注册用户: 管理员编辑页面: 管理员编辑用户: 配置 从此模板创建自己的存储库 导航到主项目页面,然后单击页面右上方的绿色大号“使用此模板”按钮。 为您的新存储库命名并保存。 克隆存储库 $ git clone https://github.com/YOUR_USERNAME/REPO_NAME.git $ cd REPO_NAME 初始化虚拟环境 视窗: $ python3 -m venv
database-project-master.zip
内容介绍
# flask-base [![Circle CI](https://circleci.com/gh/hack4impact/flask-base.svg?style=svg)](https://circleci.com/gh/hack4impact/flask-base) [![Code Climate](https://codeclimate.com/github/hack4impact/flask-base/badges/gpa.svg)](https://codeclimate.com/github/hack4impact/flask-base/coverage) [![Issue Count](https://codeclimate.com/github/hack4impact/flask-base/badges/issue_count.svg)](https://codeclimate.com/github/hack4impact/flask-base) ![python3.x](https://img.shields.io/badge/python-3.x-brightgreen.svg) ![python2.x](https://img.shields.io/badge/python-2.x-yellow.svg) ![flask-base](readme_media/logo.png) A Flask application template with the boilerplate code already done for you. **Documentation available at [http://hack4impact.github.io/flask-base](http://hack4impact.github.io/flask-base).** ## What's included? * Blueprints * User and permissions management * Flask-SQLAlchemy for databases * Flask-WTF for forms * Flask-Assets for asset management and SCSS compilation * Flask-Mail for sending emails * gzip compression * Redis Queue for handling asynchronous tasks * ZXCVBN password strength checker * CKEditor for editing pages ## Demos Home Page: ![home](readme_media/home.gif "home") Registering User: ![registering](readme_media/register.gif "register") Admin Editing Page: ![edit page](readme_media/editpage.gif "editpage") Admin Editing Users: ![edit user](readme_media/edituser.gif "edituser") ## Setting up ##### Create your own repository from this Template Navigate to the [main project page](https://github.com/hack4impact/flask-base) and click the big, green "Use this template" button at the top right of the page. Give your new repository a name and save it. ##### Clone the repository ``` $ git clone https://github.com/YOUR_USERNAME/REPO_NAME.git $ cd REPO_NAME ``` ##### Initialize a virtual environment Windows: ``` $ python3 -m venv venv $ venv\Scripts\activate.bat ``` Unix/MacOS: ``` $ python3 -m venv venv $ source venv/bin/activate ``` Learn more in [the documentation](https://docs.python.org/3/library/venv.html#creating-virtual-environments). Note: if you are using a python before 3.3, it doesn't come with venv. Install [virtualenv](https://docs.python-guide.org/dev/virtualenvs/#lower-level-virtualenv) with pip instead. ##### (If you're on a Mac) Make sure xcode tools are installed ``` $ xcode-select --install ``` ##### Add Environment Variables Create a file called `config.env` that contains environment variables. **Very important: do not include the `config.env` file in any commits. This should remain private.** You will manually maintain this file locally, and keep it in sync on your host. Variables declared in file have the following format: `ENVIRONMENT_VARIABLE=value`. You may also wrap values in double quotes like `ENVIRONMENT_VARIABLE="value with spaces"`. 1. In order for Flask to run, there must be a `SECRET_KEY` variable declared. Generating one is simple with Python 3: ``` $ python3 -c "import secrets; print(secrets.token_hex(16))" ``` This will give you a 32-character string. Copy this string and add it to your `config.env`: ``` SECRET_KEY=Generated_Random_String ``` 2. The mailing environment variables can be set as the following. We recommend using [Sendgrid](https://sendgrid.com) for a mailing SMTP server, but anything else will work as well. ``` MAIL_USERNAME=SendgridUsername MAIL_PASSWORD=SendgridPassword ``` Other useful variables include: | Variable | Default | Discussion | | --------------- |-------------| -----| | `ADMIN_EMAIL` | `flask-base-admin@example.com` | email for your first admin account | | `ADMIN_PASSWORD`| `password` | password for your first admin account | | `DATABASE_URL` | `data-dev.sqlite` | Database URL. Can be Postgres, sqlite, etc. | | `REDISTOGO_URL` | `http://localhost:6379` | [Redis To Go](https://redistogo.com) URL or any redis server url | | `RAYGUN_APIKEY` | `None` | API key for [Raygun](https://raygun.com/raygun-providers/python), a crash and performance monitoring service | | `FLASK_CONFIG` | `default` | can be `development`, `production`, `default`, `heroku`, `unix`, or `testing`. Most of the time you will use `development` or `production`. | ##### Install the dependencies ``` $ pip install -r requirements.txt ``` ##### Other dependencies for running locally You need [Redis](http://redis.io/), and [Sass](http://sass-lang.com/). Chances are, these commands will work: **Sass:** ``` $ gem install sass ``` **Redis:** _Mac (using [homebrew](http://brew.sh/)):_ ``` $ brew install redis ``` _Linux:_ ``` $ sudo apt-get install redis-server ``` You will also need to install **PostgresQL** _Mac (using homebrew):_ ``` brew install postgresql ``` _Linux (based on this [issue](https://github.com/hack4impact/flask-base/issues/96)):_ ``` sudo apt-get install libpq-dev ``` ##### Create the database ``` $ python manage.py recreate_db ``` ##### Other setup (e.g. creating roles in database) ``` $ python manage.py setup_dev ``` Note that this will create an admin user with email and password specified by the `ADMIN_EMAIL` and `ADMIN_PASSWORD` config variables. If not specified, they are both `flask-base-admin@example.com` and `password` respectively. ##### [Optional] Add fake data to the database ``` $ python manage.py add_fake_data ``` ## Running the app ``` $ source env/bin/activate $ honcho start -e config.env -f Local ``` For Windows users having issues with binding to a redis port locally, refer to [this issue](https://github.com/hack4impact/flask-base/issues/132). ## Gettin up and running with Docker and docker-compose: ##### Clone the repository ``` $ git clone https://github.com/YOUR_USERNAME/REPO_NAME.git $ cd REPO_NAME ``` ##### Create and run the images: ``` $ docker-compose up ``` ##### Create database and initial data for development: ``` $ docker-compose exec server ./init_database.sh ``` It will deploy 5 docker images: - server: Flask app running in [http://localhost:5000](http://localhost:5000). - worker: Worker ready to get tasks. - postgres: Postgres SQL isolated from the app. - adminer: Web client for database management, running in [http://localhost:8080](http://localhost:8080). - redis: Redis SQL isolated from the app ## Formatting code Before you submit changes to flask-base, you may want to autoformat your code with `python manage.py format`. ## Contributing Contributions are welcome! Please refer to our [Code of Conduct](./CONDUCT.md) for more information. ## Documentation Changes To make changes to the documentation refer to the [Mkdocs documentation](http://www.mkdocs.org/#installation) for setup. To create a new documentation page, add a file to the `docs/` directory and edit `mkdocs.yml` to reference the file. When the new files are merged into `master` and pushed to github. Run `mkdocs gh-deploy` to update the online documentation. ## Related https://medium.freecodecamp.com/how-we-got-a-2-year-old-repo-trending-on-github-in-just-48-hours-12151039d78b#.se9jwnfk5 ## License [MIT License](LICENSE.md)
评论
    相关推荐
    • Probando-Materilize-CSS
      Probando-Materilize-CSS
    • Database-course-design.rar
      js、css文件,用到的代码,加入的网页链接,以及音乐、实验报告、演示视频等
    • Liferay Database Configuration
      liferay 的数据库配置方法,可将默认数据库换成其他数据库。
    • Database
      美容基地 为美容院创建的应用程序,可帮助存储有关客户的信息并拜访他们。 自动创建有关所售产品和客户所享受金额处理的统计信息。... 实现CSS MongoDB的 链接到应用程序: : 应用程序方面将在不久的将来进行更改。
    • CSSFeaturesDatabase一个CSS特性数据库
      CSS Features Database一个CSS特性数据库,CSS特性的全面列表及其在实现Web标准过程中的立场
    • jar css js
      各种java包以及css和js样式给你更好的展示自己的作品,你用了吗?
    • UltimateModManager:用于安装 Smash Ultimate 模组的 Switch 自制应用程序
      名为MOD文件弧形路径的示例路径是UltimateModManager/mods/organized_css/ui/param/database/ui_chara_db.prc ,它会在应用程序中显示organized_css 。 用法 如果没有,请先使用 DataArcDumper 转储您的data.arc 。...
    • Blazor.Database
      其中包括一些控件,这些控件由我的上的特定文章涵盖,并已在各个网站( \ Blazor.DataBase \ Components \ Controls )上发布: EditFormState ValidationFormState 内联对话框 您可以在上在Azure上看到此站点的...
    • css教程开发
      很好的教程。希望有志者能学习好,很好的教程。希望有志者能学习好
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等