Skip to content

No module named 'mymodule' #17

@KarlKeu00

Description

@KarlKeu00

Hello everyone,
I have created a module exactly as instructed and only edited the signals.py file. I have pushed the whole module to a private GitHub repo and would now like to install it on my server.
I have written the following Dockerfile for this purpose:

FROM pretix/standalone:stable

USER root

# Copy ssh key for github
RUN mkdir -p -m 0700 /root/.ssh
COPY ./certs/id_rsa /root/.ssh/id_rsa
RUN chmod -R 0600 /root/.ssh/id_rsa

# Add key to ssh-agent
RUN eval $(ssh-agent -s) && \
    ssh-add /root/.ssh/id_rsa

# Add github.com to known_hosts and config
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN echo "Host github.com\n\tHostname github.com\n\tIdentityFile /root/.ssh/id_rsa\n" >> /root/.ssh/config

# Install plugins
RUN pip3 install -U "git+ssh://git@github.com/MyProfile/Pretix-Plugins-MyModule.git"

# Build pretix
USER pretixuser
RUN cd /pretix/src && make production

pip installs the module correctly and it also appears in pip list. Why can't pretix find the module? I get the following error:

 => ERROR [9/9] RUN cd /pretix/src && make production                                                                                                0.8s
------
 > [9/9] RUN cd /pretix/src && make production:
0.139 ./manage.py compilemessages
0.729 Traceback (most recent call last):
0.729   File "/pretix/src/./manage.py", line 31, in <module>
0.729     execute_from_command_line(sys.argv)
0.729   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
0.730     utility.execute()
0.730   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute
0.730     django.setup()
0.730   File "/usr/local/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
0.730     apps.populate(settings.INSTALLED_APPS)
0.730   File "/usr/local/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
0.731     app_config = AppConfig.create(entry)
0.731                  ^^^^^^^^^^^^^^^^^^^^^^^
0.731   File "/usr/local/lib/python3.11/site-packages/django/apps/config.py", line 193, in create
0.731     import_module(entry)
0.731   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
0.732     return _bootstrap._gcd_import(name[level:], package, level)
0.732            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.732   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.732   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.732   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
0.732 ModuleNotFoundError: No module named 'mymodule'
0.796 make: *** [Makefile:6: localecompile] Error 1
------
Dockerfile:24
--------------------
  22 |     # Build pretix
  23 |     USER pretixuser
  24 | >>> RUN cd /pretix/src && make production
  25 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /pretix/src && make production" did not complete successfully: exit code: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions