1

Need help to run django app with daphne in DEBUG mode with pycharm. Is there any way?

Arthur
  • 109
  • 8

2 Answers2

2

File: run_daphne.py

import sys

if __name__ == '__main__':
    # insert here whatever commands you use to run daphne
    sys.argv = ['daphne', 'you_app.asgi:application']
    from daphne.cli import CommandLineInterface

    CommandLineInterface.entrypoint()

We are essentially doing the same thing as daphne command line just from python. Now you can run this file with PyCharm debugger.

Note that if you are using Django-Channels the runserver command will use daphne by default.

ניר
  • 1,204
  • 1
  • 8
  • 28
0

You have to use the python debugger it will stop your code wherever you put this.

Some Code--
import pdb; pdb.set_trace()
--Some Code

It will stop execution here and to proceed use "n" one by one.

NVS
  • 400
  • 3
  • 10