当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

mlh-hackathon-flask-starter

Hackathon starter project for Flask applications
授权协议 MIT License
开发语言 Python
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 谷梁子昂
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Introduction

This is a hackathon boilerplate for new Flask web applications created by Major League Hacking. It is for hackers looking to get started quickly on a new hackathon project using the Flask microframework.

Installation Guide

This project requires the following tools:

  • Python - The programming language used by Flask.
  • PostgreSQL - A relational database system.
  • Virtualenv - A tool for creating isolated Python environments.

To get started, install Python and Postgres on your local computer if you don't have them already. A simple way for Mac OS X users to install Postgres is using Postgres.app. You can optionally use another database system instead of Postgres, like SQLite.

Getting Started

Step 1. Clone the code into a fresh folder

$ git clone https://github.com/MLH/mlh-hackathon-flask-starter.git
$ cd mlh-hackathon-flask-starter

Step 2. Create a Virtual Environment and install Dependencies.

Create a new Virtual Environment for the project and activate it. If you don't have the virtualenv command yet, you can find installation instructions here. Learn more about Virtual Environments.

$ virtualenv venv
$ source venv/bin/activate

Next, we need to install the project dependencies, which are listed in requirements.txt.

(venv) $ pip install -r requirements.txt

Step 3: Create an app on GitHub

Head over to GitHub OAuth apps and create a new OAuth app. Name it what you like but you'll need to specify a callback URL, which should be something like:

http://localhost:5000/auth/callback/github

The default port for Flask apps is 5000, but you may need to update this if your setup uses a different port or if you're hosting your app somewhere besides your local machine.

Step 4: Setup your database

You need to be able to connect to a database either on your own computer (locally) or through a hosted database. You can install Postgres locally and connect to it to provide the database for your app.

You will need to know the connection URL for your application which we will call DATABASE_URL in your environment variables. Here is an example:

postgresql://localhost:5432/mlh-hackathon-starter-flask

Step 5: Update environment variables and run the Server.

Create a new file named .env by duplicating .env.example. Update the new file with the GitHub credentials. It should look similar to this:

# .env file
DATABASE_URL="[INSERT_DATABASE_URL]"
GITHUB_CLIENT_ID="[INSERT_CLIENT_ID]"
GITHUB_CLIENT_SECRET="[INSERT_CLIENT_SECRET]"

You replace the GitHub credentials here and update the database URL. Learn more about the required Environment Variables here.

Now we're ready to start our server which is as simple as:

(venv) $ flask run

Open http://localhost:5000 to view it in your browser.

The app will automatically reload if you make changes to the code.You will see the build errors and warnings in the console.

What's Included?

  • Flask - A microframework for Python web applications
  • Flask Blueprints - A Flask extension for making modular applications
  • Flask-SQLAlchemy - A Flask extension that adds ORM support for your data models.
  • Werkzeug - A Flask framework that implements WSGI for handling requests.
  • Bootstrap 4 - An open source design system for HTML, CSS, and JS.
  • Jinja2 - A templating language for Python, used by Flask.

Code of Conduct

We enforce a Code of Conduct for all maintainers and contributors of this Guide. Read more in CONDUCT.md.

License

The Hackathon Starter Kit is open source software licensed as MIT.

 相关资料
  • Hackathon-slicer是一个基于DLP技术打印机的微型切片机。 关于 这个项目是基于DLP技术3D打印机的一个简单切片机。 它利用WebGL和模板缓冲区体素化.stl文件运行在您的浏览器。由此产生的切片将被生成一个装满.png图片的zip文件。 托管版本,进一步的文档可以在这里找到 快速安装指南 npm installnpm start

  • Hackathon Starter Kit(Node-Typescript/Express) A Node-Typescript/Express Boilerplate with Authentication(Local, Github, Facebook, Twitter, Google, LinkedIn, Dropbox, Slack, Discord), Authorization, an

  • Laravel Hackathon Starter - SUSUMU 進 If you have attended any hackathons in the past, then you know how much time it takes to get a project started: decide on what to build, pick a programming languag

  • 什么是 Design Hackathon ? Hackathon,即「黑客马拉松」,是一个流传于程序员和技术爱好者中的活动。在该活动当中,大家相聚在一起,以合作的形式去编程,整个编程的过程几乎没有任何限制或方向。Design Hackathon 类似用「黑客马拉松」的思维做产品设计,它将所有的产品设计师、视觉设计师甚至工程师聚在一起,在一定的时间内,以头脑风暴的方式,最大范围地搜集产品的各种可能性

  • 问题内容: 在官方的快速入门中,建议在使用单个 模块 时使用: 2. …如果您使用的是单个模块(如本例所示),则应使用,因为取决于它是作为应用程序启动还是作为模块导入,其名称将有所不同(与实际导入名称不同)。… 但是,在他们的API文档中,当我的应用程序为 软件包 时,建议进行硬编码: 因此,您在此处提供的内容很重要。如果使用单个模块,则始终为正确的值。但是,如果您使用的是包,通常建议在其中硬编码

  • 在前面,我们介绍了 REST Web 服务,并使用 Flask 提供服务。这里,我们使用第三方库 Flask-RESTful,它使得在 Flask 中提供 REST 服务变得更加简单。 安装 使用 pip 安装: $ pip install flask-restful 使用 下面我们主要使用官方文档的例子进行说明。 Hello World 我们先来看一个简单的例子。 # -*- coding: u