Python Docker Issues

Hello I’m trying to run a Django python project on docker but when I try to build the Dockerfile I get this error:

Note that only Django core commands are listed as settings are not properly configured (error: No module named ‘settings’).

This is the Dockerfile:

FROM python:3


COPY requirements.txt /tmp
RUN pip install -r requirements.txt 


CMD [ "python", "" ]

However when I run the command


I get no errors and the settings file is loaded correctly… So I guess that my computer does know that the file exists but can’t acknowledge it through docker for some reason ?

This is my manage .py file:

import os
import sys

def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
        from import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc

if __name__ == '__main__':

I’m a beginner and have been stuck on this for some days now, I looked for solutions online but they didn’t work… I will really appreciate your help!
Also I hope i’m posting in the correct forum

As far as I can tell, DJANGO_SETTINGS_MODULE is the name of a Python module Django imports to get the settings from[1]. In your case this is “settings”, which would be imported from a file
I assume you have a file in your local directory, which is why it works, but you aren’t copying it into the docker container.

This should be solvable by adding ADD / to your dockerfile.

[1] Django settings | Django documentation | Django