Search code examples
pythondjangocloudera

Django hosting on Cloudera applications: server not starting


I am trying to port a django web application from some server to cloudera "applications" (data science workbench) and I was trying to make it work. I managed to do so with flask and fastapi applications, just the django framework is missing. My problem, when trying the base setup (https://docs.djangoproject.com/en/3.2/intro/tutorial01/), locally works like a charm but when I try to start up the server from an instance in cloudera, the server does not start and, more curiosuly, I get a weird output related to some package of the image I am spinning. (you can see I am bypassing the traditional runserver command on django because in the cloudera applications side I cannot run shells directly and also due to the fact that I would to tie it up with some environmental variable)

below the manage.py

import os
import sys

if __name__ == '__main__':
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
    from django.core.management import execute_from_command_line
    port_to_pass = 8000
    args = ['name', 'runserver', '127.0.0.1:%d' % port_to_pass]
    execute_from_command_line(args)

weird "print" (the instance I am spinning has got the exact same package versions installed locally): enter image description here

when I should be getting:

enter image description here

any idea what might the problem be?


Solution

  • You need an extra entry.py script:

    !pip install django
    
    !python manage.py runserver 8000