import os
import sys

from salmon.server import SMTPReceiver, LMTPReceiver

sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from django.conf import settings

# where to listen for incoming messages
if settings.SALMON_SERVER["type"] == "lmtp":
    receiver = LMTPReceiver(socket=settings.SALMON_SERVER["path"])
elif settings.SALMON_SERVER["type"] == "smtp":
    receiver = SMTPReceiver(settings.SALMON_SERVER['host'],
                            settings.SALMON_SERVER['port'])

import os
import sys

from salmon.server import SMTPReceiver, LMTPReceiver

sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from django.conf import settings
import django

django.setup()

# where to listen for incoming messages
if settings.SALMON_SERVER["type"] == "lmtp":
    receiver = LMTPReceiver(socket=settings.SALMON_SERVER["path"])
elif settings.SALMON_SERVER["type"] == "smtp":
    receiver = SMTPReceiver(settings.SALMON_SERVER['host'],
                            settings.SALMON_SERVER['port'])

Call `django.setup()` in router app
Call `django.setup()` in router app

This should have been there before, but somehow we managed to get away
without it :)

fixes #99

  import os
  import sys
  
  from salmon.server import SMTPReceiver, LMTPReceiver
  
  sys.path.append('..')
  os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
  
  from django.conf import settings
+ import django
+ 
+ django.setup()
  
  # where to listen for incoming messages
  if settings.SALMON_SERVER["type"] == "lmtp":
      receiver = LMTPReceiver(socket=settings.SALMON_SERVER["path"])
  elif settings.SALMON_SERVER["type"] == "smtp":
      receiver = SMTPReceiver(settings.SALMON_SERVER['host'],
                              settings.SALMON_SERVER['port'])
  
Call `django.setup()` in router app
## Code Before:
import os
import sys

from salmon.server import SMTPReceiver, LMTPReceiver

sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from django.conf import settings

# where to listen for incoming messages
if settings.SALMON_SERVER["type"] == "lmtp":
    receiver = LMTPReceiver(socket=settings.SALMON_SERVER["path"])
elif settings.SALMON_SERVER["type"] == "smtp":
    receiver = SMTPReceiver(settings.SALMON_SERVER['host'],
                            settings.SALMON_SERVER['port'])

## Instruction:
Call `django.setup()` in router app
## Code After:
import os
import sys

from salmon.server import SMTPReceiver, LMTPReceiver

sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from django.conf import settings
import django

django.setup()

# where to listen for incoming messages
if settings.SALMON_SERVER["type"] == "lmtp":
    receiver = LMTPReceiver(socket=settings.SALMON_SERVER["path"])
elif settings.SALMON_SERVER["type"] == "smtp":
    receiver = SMTPReceiver(settings.SALMON_SERVER['host'],
                            settings.SALMON_SERVER['port'])
