title: Django: separating business logic from view logic
body: <p>possible refenrece: <a href="https://stackoverflow.com/questions/12578908/separation-of-business-logic-and-data-access-in-django">Separation of business logic and data access in django</a></p>
  
  <p>In my Django app, I am trying to figure out where to include my business logic. The logic does not fit any models(assume it's a one-page app that doesn't have any models) so I want to add a module that holds the logic. For example,</p>
  
  <p>project/app/my_logic.py</p>
  
  <pre><code>def calculate(number_one, number_two):
    return number_one + number_two
  </code></pre>
  
  <p>Then, I would use the logic like,</p>
  
  <p>project/app/views.py</p>
  
  <pre><code>def index(request):
    number = my_logic.calculate(1, 2) #can I do this?
    return HttpResponse("the number is: %s " % number)
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>Where is the right place to put <code>my_logic.py</code>?</li>
  <li>Is it conventional?</li>
  <li>What might be a better way?</li>
  </ol>
  
  <p><em>Note: this is how you import your module (if anyone else is trying to figure out how to do it)</em> </p>
  
  <pre><code>project/app/your_module/your_module.py
  project/app/your_module/__init__.py
  </code></pre>
  
  <p>from views.py,</p>
  
  <pre><code>from app.your_module import your_module
  </code></pre>