Commit 6e8e61be authored by Zhongfu Bai's avatar Zhongfu Bai
Browse files

first commit

parents
env/
venv/
vision/node_modules
vision/var
export FLASK_DEBUG=True
FLASK_DEBUG=True
export FLASK_APP=vision
FLASK_APP=vision
export VISION_SETTINGS=config.py
VISION_SETTINGS=config.py
flask run --host 0.0.0.0 --port 8000
from setuptools import setup
setup(
name='vision',
version='0.1.0',
packages=['vision'],
include_package_data=True,
install_requires=[
'bs4==0.0.1',
'Flask==1.1.1',
'requests==2.22.0',
'sh==1.12.14',
],
)
Metadata-Version: 1.0
Name: vision
Version: 0.1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
setup.py
vision/__init__.py
vision/config.py
vision/model.py
vision.egg-info/PKG-INFO
vision.egg-info/SOURCES.txt
vision.egg-info/dependency_links.txt
vision.egg-info/requires.txt
vision.egg-info/top_level.txt
\ No newline at end of file
bs4==0.0.1
Flask==1.1.1
requests==2.22.0
sh==1.12.14
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# vision
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
"""
vision package initializer.
"""
import flask
# app is a single object used by all the code modules in this package
app = flask.Flask(__name__, template_folder='public') # pylint: disable=invalid-name
# Read settings from config module
app.config.from_object('vision.config')
# Overlay settings read from file specified by environment variable. This is
# useful for using different on development and production machines.
# Reference: http://flask.pocoo.org/docs/config/
app.config.from_envvar('VISION_SETTINGS', silent=True)
# Tell our app about views and model. This is dangerously close to a
# circular import, which is naughty, but Flask was designed that way.
# (Reference http://flask.pocoo.org/docs/patterns/packages/) We're
# going to tell pylint and pycodestyle to ignore this coding style violation.
import vision.views # noqa: E402 pylint: disable=wrong-import-position
import vision.model # noqa: E402 pylint: disable=wrong-import-position
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
import os
# Root of this application, useful if it doesn't occupy an entire domain
APPLICATION_ROOT = '/'
# Secret key for encrypting cookies
SECRET_KEY = b'FIXME SET THIS WITH: $ python3 -c "import os; print(os.urandom(24))" '
SESSION_COOKIE_NAME = 'login'
# File Upload to var/uploads/
UPLOAD_FOLDER = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
'var', 'uploads'
)
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
MAX_CONTENT_LENGTH = 16 * 1024 * 1024
# Database file is var/vinsion.sqlite3
DATABASE_FILENAME = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
'var', 'vision.sqlite3'
)
import sqlite3
import flask
import vision
def dict_factory(cursor, row):
"""Convert database row objects to a dictionary. This is useful for
building dictionaries which are then used to render a template. Note that
this would be inefficient for large queries."""
output = {}
for idx, col in enumerate(cursor.description):
output[col[0]] = row[idx]
return output
def get_db():
"""Open a new database connection."""
if not hasattr(flask.g, 'sqlite_db'):
flask.g.sqlite_db = sqlite3.connect(
vision.app.config['DATABASE_FILENAME'])
flask.g.sqlite_db.row_factory = dict_factory
# Foreign keys have to be enabled per-connection. This is an sqlite3
# backwards compatibility thing.
flask.g.sqlite_db.execute("PRAGMA foreign_keys = ON")
return flask.g.sqlite_db
@vision.app.teardown_appcontext
def close_db(error):
"""Close the database at the end of a request."""
# Assertion needed to avoid style error
assert error or not error
if hasattr(flask.g, 'sqlite_db'):
flask.g.sqlite_db.commit()
flask.g.sqlite_db.close()
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "vision",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.3.2",
"vue": "^2.6.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.0.0",
"@vue/cli-plugin-eslint": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.10"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment