
import os

from django.core.wsgi import get_wsgi_application
from dj_static import Cling

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "contributr.settings.local")

# Cling is a simple way of serving static assets.
# http://www.kennethreitz.org/essays/introducing-dj-static
application = Cling(get_wsgi_application())


import os

from django.core.wsgi import get_wsgi_application

if os.environ.get("DJANGO_SETTINGS_MODULE") == "contributr.settings.production":
    # Cling is a simple way of serving static assets.
    # http://www.kennethreitz.org/essays/introducing-dj-static
    from dj_static import Cling
    application = Cling(get_wsgi_application())
else:
    application = get_wsgi_application()

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "contributr.settings.local")

Move production Cling settings into production-only block
Move production Cling settings into production-only block

The Cling import and call are moved into an if-block that is only
executed when the server is run with production settings. This
makes the server run locally again.

Resolves: #42

  
  import os
  
  from django.core.wsgi import get_wsgi_application
+ 
+ if os.environ.get("DJANGO_SETTINGS_MODULE") == "contributr.settings.production":
+     # Cling is a simple way of serving static assets.
+     # http://www.kennethreitz.org/essays/introducing-dj-static
- from dj_static import Cling
+     from dj_static import Cling
+     application = Cling(get_wsgi_application())
+ else:
+     application = get_wsgi_application()
  
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "contributr.settings.local")
  
- # Cling is a simple way of serving static assets.
- # http://www.kennethreitz.org/essays/introducing-dj-static
- application = Cling(get_wsgi_application())
- 
Move production Cling settings into production-only block
## Code Before:

import os

from django.core.wsgi import get_wsgi_application
from dj_static import Cling

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "contributr.settings.local")

# Cling is a simple way of serving static assets.
# http://www.kennethreitz.org/essays/introducing-dj-static
application = Cling(get_wsgi_application())

## Instruction:
Move production Cling settings into production-only block
## Code After:

import os

from django.core.wsgi import get_wsgi_application

if os.environ.get("DJANGO_SETTINGS_MODULE") == "contributr.settings.production":
    # Cling is a simple way of serving static assets.
    # http://www.kennethreitz.org/essays/introducing-dj-static
    from dj_static import Cling
    application = Cling(get_wsgi_application())
else:
    application = get_wsgi_application()

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "contributr.settings.local")
