juriansluiman / groceri.es Goto Github PK
View Code? Open in Web Editor NEWgroceri.es is a recipe manager and meal planning tool
License: MIT License
groceri.es is a recipe manager and meal planning tool
License: MIT License
Hello,
Never set this up before, could you please help with understanding how you get the Secret key for Flask?
I am assuming I get the following error on docker run due to missing Secret Key for Flask...
error.txt
I like to have breakfast/lunch/dinner, what changes would be required to have multiple meals per day?
Is it just me or you don't mention how to create a login after deployment of docker container?
Any advice would be welcome.
Regards,
Petyo
Checking for script in /app/prestart.sh
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
mkdir: can't create directory 'db/': File exists
The problem is in the app/prestart.sh
script, it tries to create the db/
directory, but due to mounting a volume on /app/db
this directory already exists in the container and thus the command fails.
When attempting to run the app via python app.py
I get the following error:
python app.py
Traceback (most recent call last):
File "app.py", line 25, in <module>
from models import User # noqa
File "/app/models.py", line 1, in <module>
from app import db
File "/app/app.py", line 25, in <module>
from models import User # noqa
ImportError: cannot import name 'User' from partially initialized module 'models' (most likely due to a circular import) (/app/models.py)
I'm working on a fix. Shouldn't be too complicated.
FLASK_APP=app.py FLASK_DEBUG=1 SQLALCHEMY_DATABASE_URI=sqlite:///tmp/test.db flask current
Usage: flask [OPTIONS] COMMAND [ARGS]...
Try 'flask --help' for help.
Error: No such command 'current'.
So, I followed the instructions on the readme...
git clone https://github.com/juriansluiman/groceri.es.git
cd groceri.es
(on second try I do git fetch origin pull/25/head:pr-25 && git checkout pr-25 here)
python3 -m venv ve
source ve/bin/activate
pip install -r app/requirements.txt
cd app/
FLASK_APP=app.py FLASK_DEBUG=1 SQLALCHEMY_DATABASE_URI=sqlite:///tmp/test.db flask current
and it errors
Usage: flask [OPTIONS] COMMAND [ARGS]...
Try 'flask --help' for help.
Error: No such command 'current'.
So, what am I missing or is this a bug?
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
(MX Linux)
I schedule my meals based on calories/protein per portion, should we add those to the meals listing page?
ERROR:app:Exception on /recipes/1/bakedsalmon [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2070, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1515, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1513, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1499, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 272, in decorated_view
return func(*args, **kwargs)
File "/app/./views.py", line 131, in recipe
return render_template('recipe.html', recipe=recipe)
File "/usr/local/lib/python3.8/site-packages/flask/templating.py", line 147, in render_template
return _render(
File "/usr/local/lib/python3.8/site-packages/flask/templating.py", line 128, in _render
rv = template.render(context)
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/app/templates/recipe.html", line 4, in top-level template code
{% set active_page = 'recipes' %}
File "/app/templates/layout.html", line 81, in top-level template code
{% block content %}{% endblock %}
File "/app/templates/recipe.html", line 14, in block 'content'
{{ recipe.category.name }}
File "/app/./app.py", line 48, in slug
return slugify(value)
File "/usr/local/lib/python3.8/site-packages/slugify/slugify.py", line 104, in slugify
text = _unicode(text, 'utf-8', 'ignore')
TypeError: decoding to str: need a bytes-like object, Undefined found
When building the current master as a docker image like in the docs mentioned and running it like this:
docker run -d --name groceri.es -e SECRET_KEY='mysecret' -p 84:80 groceri.es
It fails with:
Checking for script in /app/prestart.sh
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
Traceback (most recent call last):
File "/usr/local/bin/flask", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 967, in main
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 426, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_migrate/cli.py", line 209, in current
_current(directory, verbose, head_only)
File "/usr/local/lib/python3.6/site-packages/flask_migrate/__init__.py", line 96, in wrapped
f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask_migrate/__init__.py", line 369, in current
command.current(config, verbose=verbose, head_only=head_only)
TypeError: current() got an unexpected keyword argument 'head_only'
I've just installed and I get the following errors :
Checking for script in /app/prestart.sh
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
Usage: flask db current [OPTIONS]
Try 'flask db current --help' for help.
Error: While importing 'app', an ImportError was raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 218, in locate_app
import(module_name)
File "/app/app.py", line 6, in
from flask_login import LoginManager
File "/usr/local/lib/python3.8/site-packages/flask_login/init.py", line 16, in
from .login_manager import LoginManager
File "/usr/local/lib/python3.8/site-packages/flask_login/login_manager.py", line 24, in
from .utils import (login_url as make_login_url, _create_identifier,
File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 13, in
from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.8/site-packages/werkzeug/security.py)
Checking for script in /app/prestart.sh
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
Usage: flask db current [OPTIONS]
Try 'flask db current --help' for help.
Error: While importing 'app', an ImportError was raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 218, in locate_app
import(module_name)
File "/app/app.py", line 6, in
from flask_login import LoginManager
File "/usr/local/lib/python3.8/site-packages/flask_login/init.py", line 16, in
from .login_manager import LoginManager
File "/usr/local/lib/python3.8/site-packages/flask_login/login_manager.py", line 24, in
from .utils import (login_url as make_login_url, _create_identifier,
File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 13, in
from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.8/site-packages/werkzeug/security.py)
A closeable sidebar shows on small screens. With alpinejs the sidebar can be closed. After that state the user remains with:
<div>
remains as overlay so you can't interact with any clickable elements<div>
where the alpinejs object is created, so an error is thrown ReferenceError: isOpen is not defined
As a result, a user can close the sidebar but cannot open it again
It'd be great to import recipes from JSON recipe schema (see https://developers.google.com/search/docs/advanced/structured-data/recipe)
Logs from my docker container:
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
Traceback (most recent call last):
File "/usr/local/bin/flask", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 990, in main
cli.main(args=sys.argv[1:])
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 596, in main
return super().main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 439, in decorator
with __ctx.ensure_object(ScriptInfo).load_app().app_context():
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 406, in load_app
app = locate_app(self, import_name, None, raise_if_not_found=False)
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 256, in locate_app
__import__(module_name)
File "/app/app.py", line 25, in <module>
from models import User # noqa
File "/app/models.py", line 5, in <module>
recipe_tag = db.Table(
AttributeError: module 'app.db' has no attribute 'Table'
Note: I changed Flask-Login to 0.6.2. Probably not relevant.
Hello dear devs. I was interested in your application, so I figured I'd take a look at your website. The design looks great and I really like the detailed recipes!
However, I couldn't help but notice the rating you gave the Dutch Pancakes. Now, I wouldn't say they're a piece of culinary excellence, but a measly One-Star-Review really breaks my Dutch heart. Have you tried adding apple slices? Or maybe a few slices of cheese? Or even a 'stroopwafel' or two?
Keep up the good work!
In the readme, it says it is advisable to create a volume for uploaded images but it is not mentioned where the images are located inside the container.
Should publish a docker container to ghcr.io or dockerhub using GitHub actions.
Pressing the Settings
option under the menu gives an Internal Server Error
. I guess there's no routing (yet) to generate this page. I guess it'd be nice to just put an empty placeholder in.
Stack trace:
ERROR:app:Exception on /settings [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2070, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1515, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1513, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1499, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/./views.py", line 178, in settings
return render_template('settings.html',
File "/usr/local/lib/python3.8/site-packages/flask/templating.py", line 147, in render_template
return _render(
File "/usr/local/lib/python3.8/site-packages/flask/templating.py", line 128, in _render
rv = template.render(context)
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 926, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/app/templates/settings.html", line 2, in top-level template code
{% set active_page = 'settings' %}
File "/app/templates/layout.html", line 81, in top-level template code
{% block content %}{% endblock %}
File "/app/templates/settings.html", line 185, in block 'content'
let uri = '{{ url_for('profile') }}'
File "/usr/local/lib/python3.8/site-packages/flask/helpers.py", line 338, in url_for
return appctx.app.handle_url_build_error(error, endpoint, values)
File "/usr/local/lib/python3.8/site-packages/flask/helpers.py", line 325, in url_for
rv = url_adapter.build(
File "/usr/local/lib/python3.8/site-packages/werkzeug/routing.py", line 2307, in build
raise BuildError(endpoint, values, method, self)
werkzeug.routing.BuildError: Could not build url for endpoint 'profile'. Did you mean 'groceries' instead?
[pid: 24|app: 0|req: 33/57] ip () {74 vars in 1584 bytes} [Sun Aug 21 11:44:32 2022] GET /settings => generated 290 bytes in 26 msecs (HTTP/1.1 500) 3 headers in 113 bytes (1 switches on core 0)
172.28.0.7 - - [21/Aug/2022:11:44:32 +0100] "GET /settings HTTP/1.1" 500 290 "https://groceries.ares.obbard.uk/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" "ip"
Hi Everyone,
I am really excited to build this on my home server. I run a home server on a Le Potato AML S905X-CC. I currently have Ubuntu server running on this SBC. I have tried to install this on my homeserver but I keep getting issues. The current issue I am facing is that the docker container keeps exiting when started. I am not sure what I am doing wrong.
Below are the steps I have done.
git clone https://github.com/juriansluiman/groceri.es
cd groceri.es
Create a backup copy of the Dockerfile and update the Dockerfile
cp Dockerfile Dockerfile.bk
nano Dockerfile
Use an ARM-compatible base image instead of the x86_64 image:
# Dockerfile
FROM arm32v7/python:3.8-alpine
# Rest of your Dockerfile remains unchanged
Build the Docker image:
docker build -t groceri.es .
docker volume create groceries-db
docker run -d --name groceri.es -v groceries-db:/app/db -e SECRET_KEY='my-secret-here' -p 1012:80 groceri.es
docker volume create groceries-uploads
docker run -d --name groceri.es_second -v groceries-db:/app/db -v groceries-uploads:/app/uploads -e SECRET_KEY='my-secret-here' -p 1012:80 groceri.es
docker run -d --name groceri.es_app -p 1012:80 -e SECRET_KEY='my-secret-here' groceri.es
After completing these steps, I should be able to access the groceri.es
application by navigating to http://192.168.1.94:1012 in my web browser. However, the container keeps exiting and when I navigate to the webpage, I get a this site can't be reached error.
Can you please help, I am not sure what to do to fix this. Or will it not work on a SBC?
While running a newly build Docker Image it will fail instantly with following error:
Checking for script in /app/prestart.sh
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
Usage: flask db current [OPTIONS]
Try 'flask db current --help' for help.
Error: While importing 'app', an ImportError was raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 256, in locate_app
__import__(module_name)
File "/app/app.py", line 6, in <module>
from flask_login import LoginManager
File "/usr/local/lib/python3.8/site-packages/flask_login/__init__.py", line 16, in <module>
from .login_manager import LoginManager
File "/usr/local/lib/python3.8/site-packages/flask_login/login_manager.py", line 24, in <module>
from .utils import (login_url as make_login_url, _create_identifier,
File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 13, in <module>
from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.8/site-packages/werkzeug/security.py)
It might be related to https://stackoverflow.com/questions/71652965/importerror-cannot-import-name-safe-str-cmp-from-werkzeug-security
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.