Skip to content
Knot-ArchivePublic

About

获取网页页面使用nltk进行分词统计 flask demo

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

summary

split website, count word, asynchronous, save result into database.

requirement

python requirements

pip install -r requirements.txt

Local PostgreSQL and application settings

For a new local database, generate a password and an independent Flask signing key.

export POSTGRES_PASSWORD=$(python -c 'import secrets; print(secrets.token_urlsafe(24))')
export SECRET_KEY=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')
docker run --name splitsite-postgres -p 127.0.0.1:5432:5432 \
  -e POSTGRES_DB=splitsite -e POSTGRES_PASSWORD -d postgres
export DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@127.0.0.1:5432/splitsite"
export APP_SETTINGS=config.DevelopmentConfig

For an existing database, inject its connection URL and a signing key through your deployment environment. Give the web and worker processes the same settings. The default is production mode. Use the same database password when restarting an initialized local database.

MQ worker with docker: Redis

docker run --name some-redis -v /docker/host/dir:/data -d redis redis-server --appendonly yes

need Download nltk recource

python install_nltk_resource

migrations

database init

python manage.py db init

database migrate

python manage.py db migrate

database upgrade

python manage.py db upgrade

start

start up MQ worker

python worker.py

start web server

python manage.py runserver

For Jenkins deployments, configure the deploy URL as a Secret text credential named splitsite-deploy-url in Jenkins.

About

获取网页页面使用nltk进行分词统计 flask demo

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages