BitNami Django

    BitNami Django Stack for the Mac Application Store greatly simplifies setting up a full Django development environment in a single click.

    Basic usage

    First Boot

     

    The first time the application is launched, it will prepare its environment:

    first-boot.png

     

     

    The process will take a few seconds. 

    When the BitNami Stack for Django is opened, you are prompted with the Welcome page. This page allows you to do basic operations with your server such as visiting the main page ("Visit Application" button), managing your databases ("Open phpMyAdmin" button), opening the application folder in Finder ("Open Application Folder") as well as links to support and BitNami web site. It also includes buttons to follow us so you can get information about our new releases and other products. 

    welcome.png

    You can also notice how two of the buttons appear greyed out. That is because the application is not yet started. The next section will explain you how to start it.

    Managing the Services

    To start using the MAMP server, you must first start the services.  You can easily do that in "Manage Servers" tab. That page will list all the installed services and their states:

    manage-services.png

    You can manually start, stop or restart them individually using the left side buttons or start them all at once using the bottom buttons. In this case, to get a fully started MAMP server you should click "Start All". The states of all the servers will indicate the status of the process while launching them:

    starting.png

    running.png

     

    If you go back to the Welcome tab, the "Visit Application" and "Open phpMyAdmin" buttons will be now available. Clicking "Visit Application" will open the main index page in your preferred browser:

    open-app.png

     

    open-app2.png

    Changing The Application Ports

     

    By default, your MAMP server will configure the ports while initializing the first time using 8080 for Apache Web server port and 3306 for MySQL database server. However, if one of them is taken, it will automatically pick the first available one. You can view that information using the "Configure" button in the "Manage Servers" section.

     

     

     

     

     

     

     

    ports2.png

    Apart from allowing you to review the currently configured ports, you can also change their values.

     

    If the selected ports are not available, you will be prompted with a warning, and your changes won't be applied:

    ports3.png

     

    It the selected values are however valid, it will require to restart the services so the changes are taken into account. Denying it will discard the changes:

    ports4.png

     

    Viewing your services logs

    You can get some basic information about the overall state of the server checking the "Application Log" tab:

    logs1.png

     

    However, you can get a more detailed information by checking the servers log individually. To do that, you just have to select one of them from "Manage Servers" tag and select "Configure". You will find buttons pointing to the logs.

    logs2.png

    view-apache-log.png

    The logs will be opened using the "Console" application.

    Manually Editing the Configuration Files

     

    If your require further customizations of the servers beyond changing the ports, you can use the "Open Conf File" button in the "Configure" dialog:

    Please note an incorrect configuration file could make your services unable to start so you should not make changes if you are not entirely sure of the modifications or have made a backup of the original file. The application will warn you when accessing the configuration file:

    manual-edit.png

    Opening the Application Folder

     

    You can easily navigate to the application folder clicking the "Open Application Folder" button in the "Welcome" tab:

    open-app-folder.png

     

     

    That makes it easy to, for example, add files to your apache2/htdocs folder  and make them automatically accessible from other computers in your network. 

     

    Launching the Django Console

     

    To create new projects you will need to load the development environment. To do that, simply open the application folder as explained in the previous section and doubleclick on the 'use_djangostack' icon. A new Terminal window will be opened, from which you will get access to all the bundled tools such as Python and 'django-admin.py':

     

    Closing the application

     

    When closing the application, all the running services will be closed. You will be first prompted for confirmation. Answering "No" will abort closing, while "Yes" will properly shut them down and exit. This will make sure you do not end will unnoticed background services consuming resources.

    stopping.png

     

    stopping2.png

    Rate Us!

    If you liked our application and want to help others know about it, please rate us in the store. You can manually search for us or use our link button. To do that, clink in "About MampStack" in the top menu, and then "Rate i!". The "App Store"  application will be automatically opened and you will be redirected to the application page:

     

    vote.png

     

     

     

    Django Specific Usage

    Create a new project

    The best way of learning how to use your Django web framework is by following the Django first application tutorial

    To do that, first open the Django console by doubleclicking the "use_djangostack" script under the application folder:

    open-app-folder.png

     

     

    Then navigate to the django projects directory, which already contains the sample project:

     

    And you can start following the Django tutorial. You can check the simplest application posible simply executing:

     

    And check 127.0.0.1:8000 in your browser.

    This application is however running in a development HTTP server, just mean for quick tests.  If you want something a little more robust, you can serve it through the included Apache server, the same way the bundle sample project works. To do that, you can use it as a reference:

    • Copy the django.wsgi script to mysite.wsgi
    bash-3.2$ cp ~/shared/django/scripts/django.wsgi ~/shared/django/scripts/mysite.wsgi
    • Edit ~/shared/django/scripts/mysite.wsgi and replace all the references to "Project" (the sample project name) with "mysite" (our new project). The result should be similar to the below, where the changes have been highlighted:

    replacement.png

    • Copy the django.conf file to mysite.conf:
    bash-3.2$ cp ~/shared/django/conf/django.conf ~/shared/django/conf/mysite.conf
    • Edit ~/shared/django/conf/mysite.conf and adjust the "WSGIScriptAlias" directive to point to the mysite.wsgi script and match it to the "/mysite" url (you could select any other location for the url). You should obtain something similar to the below, where the changes have been highlighted:

    replace2.png

    •   Edit ~/app/apache2/conf/httpd.conf and add include the it:

     

    addingtoapache.png

    • Restart the Apache server and check the new url (typically, it will be 127.0.0.1:8080/mysite, where the port number could be different): 

    You can see that the application is the same one as before, but is now being served through Apache!

    virtualenv restrictions

    Because of the security restrictions when running under the sandbox, created files are not allowed to have executable permissions. This interferes with how virtualenv works, as it creates wrapper binaries to call the appropriate version of python and because of that is not supported.

    Tag page (Edit tags)
    • No tags
    Page statistics
    17290 view(s), 16 edit(s) and 15945 character(s)

    Comments

    You must login to post a comment.

    Attach file

    Attachments

    FileSizeDateAttached by 
     addingtoapache.png
    No description
    30.16 kB15:12, 14 May 2013JuanjoActions
     app-on-apache.png
    No description
    89.23 kB00:13, 21 Feb 2013JuanjoActions
     app.png
    No description
    88.45 kB00:13, 21 Feb 2013JuanjoActions
     console-1.png
    No description
    31.34 kB00:16, 21 Feb 2013JuanjoActions
     console-2.png
    No description
    47.13 kB00:17, 21 Feb 2013JuanjoActions
    console2.png
    No description
    26.72 kB23:07, 18 Feb 2013JuanjoActions
     first-boot.png
    No description
    139.77 kB21:44, 18 Feb 2013JuanjoActions
     logs1.png
    No description
    53.48 kB22:07, 18 Feb 2013JuanjoActions
     logs2.png
    No description
    78.64 kB22:07, 18 Feb 2013JuanjoActions
     manage-services.png
    No description
    66.4 kB21:49, 18 Feb 2013JuanjoActions
     manual-edit.png
    No description
    108.6 kB22:10, 18 Feb 2013JuanjoActions
     open-app-folder.png
    No description
    102.82 kB22:12, 18 Feb 2013JuanjoActions
     open-app-folder2.png
    No description
    50.8 kB22:13, 18 Feb 2013JuanjoActions
     open-app.png
    No description
    102.74 kB21:55, 18 Feb 2013JuanjoActions
     open-app2.png
    No description
    164.44 kB21:55, 18 Feb 2013JuanjoActions
     ports1.png
    No description
    78.3 kB22:02, 18 Feb 2013JuanjoActions
     ports2.png
    No description
    75.56 kB22:02, 18 Feb 2013JuanjoActions
     ports3.png
    No description
    84.29 kB22:02, 18 Feb 2013JuanjoActions
     ports4.png
    No description
    85.42 kB22:02, 18 Feb 2013JuanjoActions
     replace2.png
    No description
    60.07 kB00:07, 21 Feb 2013JuanjoActions
     replacement.png
    No description
    49.6 kB23:58, 20 Feb 2013JuanjoActions
     running.png
    No description
    66.33 kB21:49, 18 Feb 2013JuanjoActions
     starting.png
    No description
    66.49 kB21:49, 18 Feb 2013JuanjoActions
     stopping.png
    No description
    86.19 kB22:15, 18 Feb 2013JuanjoActions
     stopping2.png
    No description
    70.66 kB22:15, 18 Feb 2013JuanjoActions
     vote.png
    No description
    147.34 kB22:21, 18 Feb 2013JuanjoActions
     welcome.png
    No description
    137.94 kB21:44, 18 Feb 2013JuanjoActions