Docker container doesn't starts after changing host directory

I have a django app which i’m dockerizing. Below is the docker-compose.yml file (Only django part is given here)

 web:
    build: .
    command: python ./webapp/server.py
    restart: always
    volumes:
      - .:/code
      - ./webapp/static:/static
    networks:
      - nginx_network
      - couchserver_network
      - dummyapi_flaskapp_network

when i change the name of the host directory from where it is run, i’m getting the following error : python: can't open file './webapp/server.py': [Errno 2] No such file or directory
I have copied the host directory to image using :

RUN mkdir /code
WORKDIR /code
COPY . /code/

So after renaming my host directory why python is unable to find the server.py file as it is available in containers code directory.

I’m novice in docker and have little or no knowledge in volumes. Any help is really appreciated