You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running:
alembic upgrade head
in my ubuntu console.
I got this error:
Traceback (most recent call last):
File "/usr/bin/alembic", line 11, in
load_entry_point('alembic==1.1.0.dev0', 'console_scripts', 'alembic')()
File "/usr/lib/python3/dist-packages/alembic/config.py", line 540, in main
CommandLine(prog=prog).main(argv=argv)
File "/usr/lib/python3/dist-packages/alembic/config.py", line 534, in main
self.run_cmd(cfg, options)
File "/usr/lib/python3/dist-packages/alembic/config.py", line 511, in run_cmd
fn(
File "/usr/lib/python3/dist-packages/alembic/command.py", line 279, in upgrade
script.run_env()
File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 475, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 98, in load_python_file
module = load_module_py(module_id, path)
File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 174, in load_module_py
spec.loader.exec_module(module)
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "app/alembic/env.py", line 8, in
from app.db.models import Base
ModuleNotFoundError: No module named 'app'
I don't change my Dockerfile.
My docker file is:
FROM python:3.8
RUN mkdir app
WORKDIR app/
RUN apt update &&
apt install -y postgresql-client
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
The text was updated successfully, but these errors were encountered:
You need to run it inside of the Docker image, where alembic and your project dependencies are installed. From the project README:
docker-compose run --rm backend alembic upgrade head
This will run alembic upgrade head from inside your backend container. You can also connect to the container directly and run any bash command by running:
When running:
alembic upgrade head
in my ubuntu console.
I got this error:
Traceback (most recent call last):
File "/usr/bin/alembic", line 11, in
load_entry_point('alembic==1.1.0.dev0', 'console_scripts', 'alembic')()
File "/usr/lib/python3/dist-packages/alembic/config.py", line 540, in main
CommandLine(prog=prog).main(argv=argv)
File "/usr/lib/python3/dist-packages/alembic/config.py", line 534, in main
self.run_cmd(cfg, options)
File "/usr/lib/python3/dist-packages/alembic/config.py", line 511, in run_cmd
fn(
File "/usr/lib/python3/dist-packages/alembic/command.py", line 279, in upgrade
script.run_env()
File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 475, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 98, in load_python_file
module = load_module_py(module_id, path)
File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 174, in load_module_py
spec.loader.exec_module(module)
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "app/alembic/env.py", line 8, in
from app.db.models import Base
ModuleNotFoundError: No module named 'app'
I don't change my Dockerfile.
My docker file is:
FROM python:3.8
RUN mkdir app
WORKDIR app/
RUN apt update &&
apt install -y postgresql-client
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
The text was updated successfully, but these errors were encountered: