When I run python manage.py runserver on my laptop's terminal, it shows the print output - where do I see this in a Django app in opalstack ? I thought it was in logs uwsgi.log but it isn't it.

  • sean replied to this.

    anjanesh uwsgi doesn't log print statements.

    My recommendation is that you use Django's logging framework for logging but if you must use print statements for debugging then you'll need to stop your uwsgi instance and then start the Django dev server on the app's assigned port, eg:

    cd ~/apps/name_of_app
    ./stop
    source env/bin/activate
    cd myproject
    # replace NNNNN with your port
    python manage.py runserver NNNNN

    The app will then run in the foreground and will include the output from your print statements.

    It seems I can't just copy-paste print() statements to add logger.debug lines everywhere :

        print("request in index =", request)
        logger.debug("request in index =", str(request))

    TypeError: not all arguments converted during string formatting

    This is going to take a while.

    • sean replied to this.

      anjanesh if you're not using print() anywhere else you could redefine it as a function that formats the text and then passes it to the logger.

      Mastodon