Login

Dynamic DEBUG setting for PyCharm

Author:
DavidHulsmanNL
Posted:
July 26, 2017
Language:
Python
Version:
Not specified
Score:
1 (after 1 ratings)
  1. Next to the Play button you can Edit Configuration
  2. Click the green + on the left, add 2 "Django Server". Call one DEBUG, call the other RUN.
  3. Add "DEBUG False" to RUN in its "Environment variables"
  4. Add "DEBUG True" to DEBUG in its "Environment variables" (make sure the port # is different from RUN!)

Change DEBUG = True in settings.py to the below code

Go back to the main IDE window and either select RUN or DEBUG and go to localhost/404 to either see the dev debug 404 or your custom 404.html (that you obviously previously made in the /templates/ folder ;)

1
DEBUG = os.environ.get('DEBUG', False) == 'True'

More like this

  1. Template tag - list punctuation for a list of items by shapiromatron 10 months, 2 weeks ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 3 weeks ago
  3. Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
  5. Help text hyperlinks by sa2812 1 year, 7 months ago

Comments

Please login first before commenting.