SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Python/Django Question

    Hey,

    I've been playing with Django and it's pretty cool. Though I don't know a lot about it yet. I was wondering, if your server can run Python files, can Django run?

    I ask because It appears a Django application is run as a "service" by running: python manage.py startserver

    Do you only need 1 copy of Django on your server to run multiple applications? When you create a project you get a folder and it looks very light, but I'm assuming it's referencing the main Django framework.

    It seems a little scary to me because I don't understand how the Django system runs. It doesn't look like PHP on Apache where it's stateless until someone hits the page/directory. Rather, it appears that each application is it's own "type of running server".

    I hope that makes sense, if anyone can answer me thanks ahead of time.

  2. #2
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may get the answer you seek from the developers at Plone.org http://www.plone.org ; this CMS is written in Python and utilized by government agencies such as NASA and the CIA. Many of the developers utilize Django as their Python programming framework of choice.

    I'm also interested in learning Python. From what I have read thus far, developers of other languages have a harder time for Python programming is so different. However, it's a very powerful language. Add a little Jython http://www.jython.org/ and you can do just about anything. I was told to keep an open mind and to throw out the concepts of PHP when programming in Python. It's a steep learning curve. Stick with it! Apps written in Python are typically more secure than PHP. Good luck!

  3. #3
    SitePoint Member
    Join Date
    Dec 2003
    Location
    india
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree, apps written in python are more secure than php. There is also ironpython which will let you interact with .NET environment and it seems to be easy to pick up if you're newbie.

  4. #4
    SitePoint Wizard
    Join Date
    Jul 2004
    Location
    Minneapolis, MN
    Posts
    1,924
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I realise that this thread is fairly old, but I thought I would provide a more detailed answer for anyone who stumbles on this in the future.

    ---

    If your server can run Python scripts, then you should be able to run Django without a problem. You will however need access to configure Apache (or whatever server platform you use) to use mod_wsgi, mod_python, or FastCGI. Django and other Python frameworks are a tad different from PHP because they run as a separate process and interface with Apache, rather than being part of the Apache process itself (like PHP).

    The Django framework itself is stored inside your Python installation's site-packages directory. This directory is within the import scope of Python, so when you write "import django.x", it is importing the appropriate module from the Django framework located in your site-packages directory. You can run multiple websites off of one Django installation, but they will have to run as separate Django instances (different instances of startserver). You can run multiple sites off of one instance, but I would not recommend this.

    There are a variety of scripts to manage starting, stopping, and restarting Django instances. I personally use this one: http://code.djangoproject.com/wiki/InitdScriptForDebian

    I would recommend checking out the Django documentation on deployment: http://docs.djangoproject.com/en/1.2/howto/deployment/. The information here should help anyone get started on deploying Django.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •