GithubHelp home page GithubHelp logo

cuizhiqiang0 / flaskr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from silshack/flaskr

0.0 1.0 0.0 104 KB

Example code for the 'Flaskr' Flask app by Armin Ronacher

Python 68.16% CSS 12.10% HTML 19.74%

flaskr's Introduction

Code for the Flaskr blogging platform, an example written with Flask by Armin Ronacher

Instructions

1 - Install Flask

pip install Flask

2 - Install & Run Flaskr

git clone https://github.com/silshack/flaskr.git
cd flaskr
python flaskr.py

3 - Log in

Username: admin Password: default

And/or edit these variables in flaskr.py.

4 - Hackity Hack

In general:

  • Edit templates/layout.html to change the way the site's pages look
  • Add routes (pages) by editing flaskr.py and adding the appropriate templates
  • Edit static/style.css to change the site's styling if desired

In specific:

  • Create templates/about.html to be something like this:
{% extends "layout.html" %}
{% block body %}
  <h2>About</h2>
  <p>Here's a little about me</p>
{% endblock %}
  • Add a route for your about page in flaskr.py:
@app.route('/about')
def about():
    return render_template('about.html')

  • Add a link to your templates/layout.html:
...
  <h1>Flaskr</h1>
  <div class=metanav>
  ## Add this line:
    <a href="{{ url_for('about') }}">about</a>
  {% if not session.logged_in %}
...

Original documentation:

                     / Flaskr /

             a minimal blog application


~ What is Flaskr?

  A sqlite powered thumble blog application

~ How do I use it?

  1. edit the configuration in the flaskr.py file or
     export an FLASKR_SETTINGS environment variable
     pointing to a configuration file.

  2. now you can run the flaskr.py file with your
     python interpreter and the application will
     greet you on http://localhost:5000/

~ Is it tested?

  You betcha.  Run the `flaskr_tests.py` file to see
  the tests pass.

flaskr's People

Contributors

eah13 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.