greyli / sayhello Goto Github PK
View Code? Open in Web Editor NEWA simple message board application build with Flask.
Home Page: http://sayhello.helloflask.com
License: MIT License
A simple message board application build with Flask.
Home Page: http://sayhello.helloflask.com
License: MIT License
Dd
在index.html中,{% from 'bootstrap/form.html' import render_form %}导入的宏,但是仓库代码中并没有。
而且书上写的是{% from 'macros.html' import form_field %},两者存在不一致,而且缺失这部分代码
messages = Message.query.order_by(Message.timestamp.desc()).all()
移动到最后的return之前。
@app.route('/', methods=['GET', 'POST'])
def index():
form = HelloForm()
if form.validate_on_submit():
name = form.name.data
body = form.body.data
message = Message(body=body, name=name)
db.session.add(message)
db.session.commit()
flash('Your message have been sent to the world!')
return redirect(url_for('index'))
messages = Message.query.order_by(Message.timestamp.desc()).all()
return render_template('index.html', form=form, messages=messages)
Traceback (most recent call last):
File "C:/Users/DELL/Desktop/say_hello/sayhello/test_sayhello.py", line 67, in test_create_message
), follow_redirects=True)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1039, in post
return self.open(*args, **kw)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\testing.py", line 227, in open
follow_redirects=follow_redirects,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1017, in open
response, new_location, environ, buffered=buffered
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 948, in resolve_redirect
return self.open(builder, as_tuple=True, buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\testing.py", line 227, in open
follow_redirects=follow_redirects,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 993, in open
response = self.run_wsgi_app(environ.copy(), buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 884, in run_wsgi_app
rv = run_wsgi_app(self.application, environ, buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1119, in run_wsgi_app
app_rv = app(environ, start_response)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\DELL\Desktop\say_hello\sayhello\sayhello\views.py", line 28, in index
return render_template('index.html', form=form, messages=messages)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 140, in render_template
ctx.app,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 120, in _render
rv = template.render(context)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "C:\Users\DELL\Desktop\say_hello\sayhello\sayhello\templates\index.html", line 2, in top-level template code
{% from 'bootstrap/form.html' import render_form %}
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 60, in get_source
return self._get_source_fast(environment, template)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 89, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: bootstrap/form.html
Traceback (most recent call last):
File "C:/Users/DELL/Desktop/say_hello/sayhello/test_sayhello.py", line 76, in test_form_validation
), follow_redirects=True)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1039, in post
return self.open(*args, **kw)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\testing.py", line 227, in open
follow_redirects=follow_redirects,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 993, in open
response = self.run_wsgi_app(environ.copy(), buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 884, in run_wsgi_app
rv = run_wsgi_app(self.application, environ, buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1119, in run_wsgi_app
app_rv = app(environ, start_response)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\DELL\Desktop\say_hello\sayhello\sayhello\views.py", line 28, in index
return render_template('index.html', form=form, messages=messages)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 140, in render_template
ctx.app,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 120, in _render
rv = template.render(context)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "C:\Users\DELL\Desktop\say_hello\sayhello\sayhello\templates\index.html", line 2, in top-level template code
{% from 'bootstrap/form.html' import render_form %}
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 60, in get_source
return self._get_source_fast(environment, template)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 89, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: bootstrap/form.html
Traceback (most recent call last):
File "C:/Users/DELL/Desktop/say_hello/sayhello/test_sayhello.py", line 59, in test_index_page
response = self.client.get('/')
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1029, in get
return self.open(*args, **kw)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\testing.py", line 227, in open
follow_redirects=follow_redirects,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 993, in open
response = self.run_wsgi_app(environ.copy(), buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 884, in run_wsgi_app
rv = run_wsgi_app(self.application, environ, buffered=buffered)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\werkzeug\test.py", line 1119, in run_wsgi_app
app_rv = app(environ, start_response)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\DELL\Desktop\say_hello\sayhello\sayhello\views.py", line 28, in index
return render_template('index.html', form=form, messages=messages)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 140, in render_template
ctx.app,
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 120, in _render
rv = template.render(context)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\jinja2_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "C:\Users\DELL\Desktop\say_hello\sayhello\sayhello\templates\index.html", line 2, in top-level template code
{% from 'bootstrap/form.html' import render_form %}
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 60, in get_source
return self._get_source_fast(environment, template)
File "C:\Users\DELL.virtualenvs\flasky-k2ovOsk9\lib\site-packages\flask\templating.py", line 89, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: bootstrap/form.html
Traceback (most recent call last):
File "C:/Users/DELL/Desktop/say_hello/sayhello/test_sayhello.py", line 82, in test_forge_command
self.assertIn('Created 20 fake messages.', result.output)
AssertionError: 'Created 20 fake messages.' not found in ''
Traceback (most recent call last):
File "C:/Users/DELL/Desktop/say_hello/sayhello/test_sayhello.py", line 87, in test_forge_command_with_count
self.assertIn('Created 50 fake messages.', result.output)
AssertionError: 'Created 50 fake messages.' not found in ''
Ran 11 tests in 0.057s
FAILED (failures=2, errors=3)
Process finished with exit code 1
原描述是:
作为替代,你也可以加载Bootstrap提供的合集包文件bootstrap.bundle.min.css
应该是:
bootstrap.bundle.min.css
→ bootstrap.bundle.min.js
当我在执行pip install -r requirements.txt,报以下错误:
Requirement already satisfied: bootstrap-flask==1.2.0 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (1.2.0)
Requirement already satisfied: click==7.1.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (7.1.1)
Requirement already satisfied: flask-moment==0.9.0 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (0.9.0)
Requirement already satisfied: flask-sqlalchemy==2.4.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 4)) (2.4.1)
Requirement already satisfied: flask-wtf==0.14.3 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 5)) (0.14.3)
Requirement already satisfied: flask==1.1.2 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 6)) (1.1.2)
Requirement already satisfied: itsdangerous==1.1.0 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 7)) (1.1.0)
Requirement already satisfied: jinja2==2.11.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 8)) (2.11.1)
Requirement already satisfied: markupsafe==1.1.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 9)) (1.1.1)
Requirement already satisfied: python-dotenv==0.12.0 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 10)) (0.12.0)
Requirement already satisfied: sqlalchemy==1.3.15 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 11)) (1.3.15)
Requirement already satisfied: werkzeug==1.0.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 12)) (1.0.1)
Requirement already satisfied: wtforms==2.2.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 13)) (2.2.1)
Requirement already satisfied: faker==4.0.2 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 15)) (4.0.2)
Requirement already satisfied: pathtools==0.1.2 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 16)) (0.1.2)
Requirement already satisfied: python-dateutil==2.8.1 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 17)) (2.8.1)
Requirement already satisfied: six==1.14.0 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 18)) (1.14.0)
Requirement already satisfied: text-unidecode==1.3 in ./env/lib/python3.6/site-packages (from -r requirements.txt (line 19)) (1.3)
Collecting watchdog==0.10.2 (from -r requirements.txt (line 20))
Downloading https://files.pythonhosted.org/packages/73/c3/ed6d992006837e011baca89476a4bbffb0a91602432f73bd4473816c76e2/watchdog-0.10.2.tar.gz (95kB)
100% |████████████████████████████████| 102kB 7.7kB/s
Installing collected packages: watchdog
Running setup.py install for watchdog ... error
Complete output from command /Users/lidianxiang/Desktop/flask_project/sayhello/env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/pip-install-d6a7sr3v/watchdog/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/pip-record-l65wyez7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/lidianxiang/Desktop/flask_project/sayhello/env/include/site/python3.6/watchdog:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/watchdog
copying src/watchdog/watchmedo.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog
copying src/watchdog/version.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog
copying src/watchdog/events.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog
copying src/watchdog/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog
creating build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/unicode_paths.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/compat.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/win32stat.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/dirsnapshot.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/delayed_queue.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/platform.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/bricks.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
copying src/watchdog/utils/echo.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/utils
creating build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/fsevents.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/inotify.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/api.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/inotify_buffer.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/winapi.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/read_directory_changes.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/kqueue.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/inotify_c.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/polling.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
copying src/watchdog/observers/fsevents2.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/observers
creating build/lib.macosx-10.9-x86_64-3.6/watchdog/tricks
copying src/watchdog/tricks/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/watchdog/tricks
running egg_info
writing src/watchdog.egg-info/PKG-INFO
writing dependency_links to src/watchdog.egg-info/dependency_links.txt
writing entry points to src/watchdog.egg-info/entry_points.txt
writing requirements to src/watchdog.egg-info/requires.txt
writing top-level names to src/watchdog.egg-info/top_level.txt
reading manifest file 'src/watchdog.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.h' under directory 'src'
writing manifest file 'src/watchdog.egg-info/SOURCES.txt'
running build_ext
building '_watchdog_fsevents' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/lidianxiang/anaconda3/envs/tensorflow2/include -arch x86_64 -I/Users/lidianxiang/anaconda3/envs/tensorflow2/include -arch x86_64 -I/opt/X11/include -DWATCHDOG_VERSION_STRING="0.10.2" -DWATCHDOG_VERSION_MAJOR=0 -DWATCHDOG_VERSION_MINOR=10 -DWATCHDOG_VERSION_BUILD=2 -I/Users/lidianxiang/Desktop/flask_project/sayhello/env/include -I/Users/lidianxiang/anaconda3/envs/tensorflow2/include/python3.6m -c src/watchdog_fsevents.c -o build/temp.macosx-10.9-x86_64-3.6/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-nullability-completeness -Wno-nullability-extension -Wno-newline-eof -Wno-error=unused-command-line-argument
cc1: error: -Werror=unused-command-line-argument: no option -Wunused-command-line-argument
cc1: warning: unrecognized command line option '-Wno-newline-eof'
cc1: warning: unrecognized command line option '-Wno-nullability-extension'
cc1: warning: unrecognized command line option '-Wno-nullability-completeness'
error: command 'gcc' failed with exit status 1
TypeError: environment can only contain strings
git push heroku master 後不行在heroku 運行
logs 如下
(sayhello--PmzIgZ-) D:\microblog\sayhello>heroku logs
2018-12-11T19:25:18.687418+00:00 app[api]: Release v2 created by user 4755813@gm
ail.com
2018-12-11T19:25:18.582601+00:00 app[api]: Release v1 created by user 4755813@gm
ail.com
2018-12-11T19:25:18.582601+00:00 app[api]: Initial release by user 4755813@gmail
.com
2018-12-11T19:26:32.000000+00:00 app[api]: Build started by user [email protected]
om
2018-12-11T19:27:15.746760+00:00 app[api]: Deploy d8a33dd by user 4755813@gmail
.com
2018-12-11T19:27:25.000000+00:00 app[api]: Build succeeded
2018-12-11T19:27:50.044086+00:00 heroku[router]: at=error code=H14 desc="No web
processes running" method=GET path="/" host=xvcr.herokuapp.com request_id=961f93
49-858c-46f4-8c75-4b40370cd26f fwd="61.230.133.26" dyno= connect= service= statu
s=503 bytes= protocol=https
2018-12-11T19:27:50.486954+00:00 heroku[router]: at=error code=H14 desc="No web
processes running" method=GET path="/favicon.ico" host=xvcr.herokuapp.com reques
t_id=2243059c-c124-4c1c-bf3e-849ad03f665a fwd="61.230.133.26" dyno= connect= ser
vice= status=503 bytes= protocol=https
2018-12-11T19:29:33.801883+00:00 heroku[router]: at=error code=H14 desc="No web
processes running" method=GET path="/" host=xvcr.herokuapp.com request_id=52da68
34-b91f-4267-921c-89912d07a696 fwd="61.230.133.26" dyno= connect= service= statu
s=503 bytes= protocol=https
2018-12-11T19:29:34.079349+00:00 heroku[router]: at=error code=H14 desc="No web
processes running" method=GET path="/favicon.ico" host=xvcr.herokuapp.com reques
t_id=6ed2effc-7538-4e82-9455-3bacbaa0fe85 fwd="61.230.133.26" dyno= connect= ser
vice= status=503 bytes= protocol=https
i want add delete function,but i do not know how to add submit and view function
您好,最近看书部署部分,用gunicorn想部署下sayhello程序实验。
在sayhello目录下运行gunicorn sayhello:app
可以正常
但是在sayhello/sayhello下运行gunicorn __init__:app
提示如下
[2019-03-23 22:52:35 +0800] [73809] [INFO] Starting gunicorn 19.9.0
[2019-03-23 22:52:35 +0800] [73809] [INFO] Listening at: http://127.0.0.1:8000 (73809)
[2019-03-23 22:52:35 +0800] [73809] [INFO] Using worker: sync
[2019-03-23 22:52:35 +0800] [73812] [INFO] Booting worker with pid: 73812
[2019-03-23 22:52:35 +0800] [73812] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/Users/lovehxy/Downloads/sayhello/sayhello/__init__.py", line 14, in <module>
app.config.from_pyfile('settings.py')
File "/usr/local/lib/python3.7/site-packages/flask/config.py", line 130, in from_pyfile
exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
File "/Users/lovehxy/Downloads/sayhello/sayhello/settings.py", line 11, in <module>
from sayhello import app
ModuleNotFoundError: No module named 'sayhello'
[2019-03-23 22:52:35 +0800] [73812] [INFO] Worker exiting (pid: 73812)
[2019-03-23 22:52:35 +0800] [73809] [INFO] Shutting down: Master
[2019-03-23 22:52:35 +0800] [73809] [INFO] Reason: Worker failed to boot.
请教原因?
(albumy-master) [miaohf@localhost albumy-master]$ flask forge
Usage: flask [OPTIONS] COMMAND [ARGS]...
Error: No such command "forge".
(albumy-master) [miaohf@localhost albumy-master]$ exit
exit
[miaohf@localhost albumy-master]$ su
Password:
[root@localhost albumy-master]# pip install faker
Requirement already satisfied: faker in /usr/lib64/python3.6/site-packages (1.0.5)
Requirement already satisfied: python-dateutil>=2.4 in /usr/lib/python3.6/site-packages (from faker) (2.8.0)
Requirement already satisfied: six>=1.10 in /usr/lib/python3.6/site-packages (from faker) (1.12.0)
Requirement already satisfied: text-unidecode==1.2 in /usr/lib/python3.6/site-packages (from faker) (1.2)
You are using pip version 19.0.2, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@localhost albumy-master]# exit
exit
[miaohf@localhost albumy-master]$ pipenv shell
Launching subshell in virtual environment…
[miaohf@localhost albumy-master]$ . /home/miaohf/.local/share/virtualenvs/albumy-master-YKY7lYtz/bin/activate
(albumy-master) [miaohf@localhost albumy-master]$ flask forge
Usage: flask [OPTIONS] COMMAND [ARGS]...
Error: No such command "forge".
(albumy-master) [miaohf@localhost albumy-master]$ exit
exit
[miaohf@localhost albumy-master]$
[miaohf@localhost albumy-master]$
[miaohf@localhost albumy-master]$ pipenv install --dev
Installing dependencies from Pipfile.lock (15e1b5)…
Ignoring ipaddress: markers 'python_version == "2.7"' don't match your environment
Looking in indexes: https://pypi.python.org/simple
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 30/30 — 00:00:14
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
[miaohf@localhost albumy-master]$ pipenv shell
Launching subshell in virtual environment…
[miaohf@localhost albumy-master]$ . /home/miaohf/.local/share/virtualenvs/albumy-master-YKY7lYtz/bin/activate
(albumy-master) [miaohf@localhost albumy-master]$ flask forge
Usage: flask [OPTIONS] COMMAND [ARGS]...
Error: No such command "forge".
(albumy-master) [miaohf@localhost albumy-master]$ flask run -h 0.0.0.0
AssertionError: View function mapping is overwriting an existing endpoint function: index
这是编译器的报错,可是整个项目中只有一个index函数,尝试了很多方法都没解决,求助。
ubuntu上运行没有看到生成的 data.db文件???
Hi!
requirements.txt lists mako==1.1.13 as a dependency - this version simply doesn't exist on pypi. Works like a charm after changing this to any valid version.
Also, werkzeug is outdated and fails on Python3.9; updating its version to werkzeug==0.15.5 helps.
Cheers,
作者你好,我fork了 您的文件,在根目录下写了一个start.py
from sayhello import app
import flask
FLASK_DEBUG = 1
if __name__ == '__main__':
app.run(debug=True)
执行后报错为:sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: message。
烦请您指点一下。
Please upgrade to latest version Bootstrap-Flask.
https://github.com/greyli/sayhello/blob/master/requirements.txt#L1
flask forge
Usage: flask [OPTIONS] COMMAND [ARGS]...
Error: No such command "forge".
想在朋友缠绕膜上对该项目进行相应的修改,但不知道该怎么样做
一直都是按照教程走的
python 3.4 windows10
clone下来 进入项目 安装依赖的时候就这样
pip 18 pipenv v2018.7.1
Administrator@88DPIN40VXPT4MR MINGW64 /c/ENV/pro/sayhello (master)
$ pipenv install --dev --pypi-mirror https://mirrors.aliyun.com/pypi/simple
Installing dependencies from Pipfile.lock (b158df)...
An error occurred while installing argh==0.26.2! Will try again.
An error occurred while installing ipaddress==1.0.22; python_version == '2.7'! Will try again.
An error occurred while installing text-unidecode==1.2! Will try again.
An error occurred while installing faker==0.8.17! Will try again.
An error occurred while installing six==1.11.0! Will try again.
An error occurred while installing python-dateutil==2.7.3! Will try again.
An error occurred while installing pathtools==0.1.2! Will try again.
An error occurred while installing watchdog==0.8.3! Will try again.
An error occurred while installing pyyaml==3.13! Will try again.
An error occurred while installing python-dotenv==0.8.2! Will try again.
An error occurred while installing itsdangerous==0.24! Will try again.
An error occurred while installing flask-wtf==0.14.2! Will try again.
An error occurred while installing click==6.7! Will try again.
An error occurred while installing jinja2==2.10! Will try again.
An error occurred while installing flask==1.0.2! Will try again.
Could not import runpy module
ModuleNotFoundError: No module named 'runpy'
jinja2.exceptions.TemplateNotFound: bootstrap/form.html
\sayhello\templates\index.html:
{% from 'bootstrap/form.html' import render_form %}
没发现bootstrap/form.html啊
想用pycharm调试,没有__main__入口,没法运行
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.