Git Product home page Git Product logo

weeklyreport's Introduction

demo: https://wr.mcloud.fun:81

#加入docker-compose

可以在新机器上, 直接一键启动了: docker-compose up

加入entrypoint.sh脚本: 1 启动时先等待pg启动 2 判断pg里是否已经有表 3 如果没有表, 初始化表 4 用gunicorn 启动 app

快速运行

-w <N>为开启的gunicorn worker进程数 -p 8000:80 主机通过8000端口访问

git clone https://github.com/CodingCrush/WeeklyReport && \

cd WeeklyReport && \

docker build -t weeklyreport:0.2 . && \

docker run -d \
        --restart=unless-stopped \
        --name weeklyreport-server \
        -p 8000:80 \
        -v /etc/localtime:/etc/localtime:ro \
        -v $PWD:/opt/weeklyreport \
        weeklyreport:0.2 \
        gunicorn wsgi:app --bind 0.0.0.0:80 -w 2 --log-file logs/awsgi.log --log-level=DEBUG

更新说明

V0.2: 简化了部署步骤

配置说明

  • 配置数据库 数据库默认使用sqlite,也可以使用postgres container,cd到postgres目录下,pull镜像,启动。 数据库URI地址由数据库名、用户名、密码、主机、端口号组成。
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:postgres@localhost/wr_prd'

步骤见postgres目录下的readme.md

  • 配置config.py

DEPARTMENTS: 这个元组为部门列表,第一次打开时自动初始化到数据库中,用户在注册时可以选择部门。

MAIL_USERNAME : 用来发送邮件通知的邮箱账号

MAIL_PASSWORD : 用来发送邮件通知的邮箱密码

后台管理

第一次注册的用户为超级管理员,永远有登录后台的权限。 管理员可以修改其他角色

默认用户角色为EMPLOYEE,仅具有读写自己的周报的权限,

MANAGER可以读写周报,并查看本部门所有周报。而HR可以读写周报,并查看全部门所有周报。

ADMINISTRATOR在HR基础上增加了进入后台的功能。

QUIT用来标识离职后的员工,禁止其登录。

weeklyreport's People

Contributors

codingcrush avatar t3573393 avatar xuqinghan 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weeklyreport's Issues

docker部署错误

hi,
我按照步骤执行,
git clone
docker run
都没问题
然后执行 docker-compose up 会出现很多语法错误
比如
api_1 | File "/deploy/app/__init__.py", line 10, in <module> api_1 | from utils import get_last_week_content, get_week_days api_1 | ModuleNotFoundError: No module named 'utils'
然后我把utils改成了app.utils解决了
然后deploy/app/models.py 64, 65line 缩进有问题,用的是tab,这个也解决了
然后还有一堆语法错误,比如deploy/wsgi.py里的
reload(sys)
sys.setdefaultencoding('utf8')
但我看python3没有reload?(reload在另一个包里,from importlib import reload)
所以我怀疑是不是我步骤搞错了,或者python版本有问题?
帮忙看下,谢谢!

cannot import name 'get_last_week_content'

docker 运行过程中报了一堆缺少运行依赖的包。补充requirements.txt文件内后报如下错误:

ImportError: cannot import name 'get_last_week_content'

这。。utils引入的有问题啊,需要高版本么?

建议requirements.txt里面的清单指定版本

求助!执行docker build时出现的错误!

Step 4/16 : RUN ln -s -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && curl -fsSL https://setup.ius.io/ | sh && yum update -y && yum install -y python36u python36u-devel python36u-pip && mkdir ~/.pip && echo -e "[global]\nindex-url=http://pypi.douban.com/simple/\ntrusted-host=pypi.douban.com">~/.pip/pip.conf && yum clean all
---> Running in a2f104bc8de5

curl: (6) Could not resolve host: setup.ius.io; Unknown error
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

关于环境

也许由于时间较长,好多库都已经产生较大变换导致直接部署时不兼容,请问可以给出每个环境可以稳定运行的版本么?谢谢!

如何在本地服务器部署该周报系统

按照Readme的步骤在windows 10上进行部署,运行服务端(python manage.py runserver),输入127.0.0.1:5000/index,网页显示“URL不可用”,登陆页面出现“Internal Server Error” 这是什么导致的呢?

部门无法删除

为什么部门信息无法删除呢,而且控制台还有报错。请指教。
`daterangepicker.js?v=1.3.22:30 Uncaught ReferenceError: moment is not defined
at daterangepicker.js?v=1.3.22:30
at daterangepicker.js?v=1.3.22:33

form.js?v=1.0.1:596 Uncaught ReferenceError: $ is not defined
at form.js?v=1.0.1:596
at form.js?v=1.0.1:610

(index):399 Uncaught ReferenceError: jQuery is not defined
at (index):399

配置的连接postgresql数据库怎么报连接拒绝

File "/usr/lib/python3.6/site-packages/sqlalchemy/pool.py", line 350, in _create_connection
return _ConnectionRecord(self)
File "/usr/lib/python3.6/site-packages/sqlalchemy/pool.py", line 477, in init
self.__connect(first_connect_check=True)
File "/usr/lib/python3.6/site-packages/sqlalchemy/pool.py", line 667, in __connect
connection = pool._invoke_creator(self)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 106, in connect
return dialect.connect(*cargs, **cparams)
File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 410, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/usr/lib64/python3.6/site-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Network is unreachable
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sg4cklnw/psycopg2/

我在部署的时候一直报这个错误,请问怎么解决呢

[root@localhost WeeklyReport]# docker build -t weeklyreport:0.2 . Sending build context to Docker daemon 48.49MB Step 1/16 : FROM centos:7 ---> 5e35e350aded Step 2/16 : MAINTAINER CodingCrush ---> Using cache ---> 7f48056d2244 Step 3/16 : ENV LANG en_US.UTF-8 ---> Using cache ---> 8071860d93f3 Step 4/16 : RUN ln -s -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && curl -fsSL https://setup.ius.io/ | sh && yum update -y && yum install -y python36u python36u-devel python36u-pip && mkdir ~/.pip && echo -e "[global]\nindex-url=http://pypi.douban.com/simple/\ntrusted-host=pypi.douban.com">~/.pip/pip.conf && yum clean all ---> Using cache ---> 5a1e5ab969d7 Step 5/16 : RUN yum install -y supervisor ---> Using cache ---> 7dc748f7eb90 Step 6/16 : RUN mkdir -p /deploy ---> Using cache ---> ce1cf984ec87 Step 7/16 : WORKDIR /deploy ---> Using cache ---> 7e373e00d624 Step 8/16 : COPY requirements.txt /deploy/requirements.txt ---> Using cache ---> 5f616ea0a7bd Step 9/16 : RUN pip3.6 install -r requirements.txt --timeout=120 ---> Running in ba054833bd9e WARNING: Running pip install with root privileges is generally not a good idea. Try pip3.6 install --user` instead.
Collecting flask (from -r requirements.txt (line 1))
Downloading http://pypi.doubanio.com/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl (94kB)
Collecting flask_bootstrap (from -r requirements.txt (line 2))
Downloading http://pypi.doubanio.com/packages/88/53/958ce7c2aa26280b7fd7f3eecbf13053f1302ee2acb1db58ef32e1c23c2a/Flask-Bootstrap-3.3.7.1.tar.gz (456kB)
Collecting flask_login (from -r requirements.txt (line 3))
Downloading http://pypi.doubanio.com/packages/c1/ff/bd9a4d2d81bf0c07d9e53e8cd3d675c56553719bbefd372df69bf1b3c1e4/Flask-Login-0.4.1.tar.gz
Collecting flask_script (from -r requirements.txt (line 4))
Downloading http://pypi.doubanio.com/packages/00/a4/cd587b2b19f043b65bf33ceda2f6e4e6cdbd0ce18d01a52b9559781b1da6/Flask-Script-2.0.6.tar.gz (43kB)
Collecting flask_wtf (from -r requirements.txt (line 5))
Downloading http://pypi.doubanio.com/packages/60/3a/58c629472d10539ae5167dc7c1fecfa95dd7d0b7864623931e3776438a24/Flask_WTF-0.14.2-py2.py3-none-any.whl
Collecting Flask-Mail (from -r requirements.txt (line 6))
Downloading http://pypi.doubanio.com/packages/05/2f/6a545452040c2556559779db87148d2a85e78a26f90326647b51dc5e81e9/Flask-Mail-0.9.1.tar.gz (45kB)
Collecting flask-admin (from -r requirements.txt (line 7))
Downloading http://pypi.doubanio.com/packages/03/4e/a92e3c5cee3fce68fda877b437ed4657df3a0168091f6d2cab6c94d932e3/Flask-Admin-1.5.4.tar.gz (1.7MB)
Collecting gunicorn (from -r requirements.txt (line 8))
Downloading http://pypi.doubanio.com/packages/69/ca/926f7cd3a2014b16870086b2d0fdc84a9e49473c68a8dff8b57f7c156f43/gunicorn-20.0.4-py2.py3-none-any.whl (77kB)
Collecting chartkick (from -r requirements.txt (line 9))
Downloading http://pypi.doubanio.com/packages/cc/ce/623769bffe0a4849e4008b52d17a2d4ef57d42eca96954e8593325670967/chartkick-0.5.0.tar.gz
Collecting flask_sqlalchemy (from -r requirements.txt (line 10))
Downloading http://pypi.doubanio.com/packages/1e/65/226d95466c75e34e291a76890ed0e27af2e46ab913002847856f11d4d59d/Flask_SQLAlchemy-2.4.1-py2.py3-none-any.whl
Collecting flask_migrate (from -r requirements.txt (line 11))
Downloading http://pypi.doubanio.com/packages/4b/22/d20a105f13c58fe590ef38ac59d5cabc1a917549ea8f90b0ca7b4e84f6be/Flask_Migrate-2.5.2-py2.py3-none-any.whl
Collecting flask_babelex (from -r requirements.txt (line 12))
Downloading http://pypi.doubanio.com/packages/80/ad/cc2b0becd98050eed775ca85d6e5fa784547acff69f968183098df8a52b3/Flask-BabelEx-0.9.3.tar.gz (41kB)
Collecting pymysql (from -r requirements.txt (line 13))
Downloading http://pypi.doubanio.com/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whl (47kB)
Collecting psycopg2 (from -r requirements.txt (line 14))
Downloading http://pypi.doubanio.com/packages/84/d7/6a93c99b5ba4d4d22daa3928b983cec66df4536ca50b22ce5dcac65e4e71/psycopg2-2.8.4.tar.gz (377kB)
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found.

pg_config is required to build psycopg2 from source.  Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.

If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.

For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).


----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sg4cklnw/psycopg2/
The command '/bin/sh -c pip3.6 install -r requirements.txt --timeout=120' returned a non-zero code: 1
`

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.