Giter Site home page Giter Site logo

web_blog's Introduction

Web blog

Original course code | Code updated to Flask 2.0

This is a simple web-based blog that doesn't do much but introduces Flask, HTML, CSS, Bootstrap, Jinja2, and other concepts such as endpoints and APIs.

The blog requires MongoDB to be running without authentication enabled.

Once this is running, execute the app with flask run and navigate to the endpoint (default: http://127.0.0.1:5000/).

The available endpoints are:

  • /
  • /login
  • /register
  • /blogs
  • /blogs/new
  • /posts/<string:blog_id>
  • /posts/new/<string:blog_id>

How to use this code

  1. Create a new virtual environment: python -m venv .venv
  2. Activate the virtual environment:

In powershell:

.\.venv\Scripts\activate

In bash

source .venv/Scripts/activate

In CMD

.venv\Scripts\activate

In Mac OS / Linux:

source .venv/bin/activate
  1. Verify that the file .flaskenv is in the top directory and that it contains the environment variable FLASK_APP=src.app.

  2. Run the app

flask run

web_blog's People

Contributors

jslvtr avatar lus24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

web_blog's Issues

Database.insert(collection='posts',data=self.json())

Traceback (most recent call last):
File "d:\myprograms\python\test.py", line 9, in
post.save_to_mongo()
File "d:\myprograms\python\post.py", line 15, in save_to_mongo
Database.insert(collection='posts',data=self.json())
TypeError: insert() got an unexpected keyword argument 'data'

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.