Custom Search

Thursday, January 3, 2013

Introduction pyramid development.ini production.ini MANIFEST.in and setup.py

Introduction to the pyramid development.ini production.ini MANIFEST.in and setup.py

1)
development.ini
============

a)
The development.ini file is a PasteDeploy configuration file. Its purpose is to specify an application to run when you invoke pserve, as well as the deployment settings provided to that application.

b)
The [app:main] section represents configuration for your Pyramid application. The use setting is the only setting required to be present in the [app:main] section. Its default value, egg:MyProject, indicates that our MyProject project contains the application that should be served. Other settings added to this section are passed as keyword arguments to the function named main in our package’s __init__.py module. You can provide startup-time configuration parameters to your application by adding more settings to this section.

c)

The name main in [app:main] signifies that this is the default application run by pserve when it is invoked against this configuration file. The name main is a convention used by PasteDeploy signifying that it is the default application.

d)
The [server:main] section of the configuration file configures a WSGI server which listens on TCP port 6543. It is configured to listen on all interfaces (0.0.0.0). This means that any remote system which has TCP access to your system can see your Pyramid application.

2)
production.ini
===========

The production.ini file is a PasteDeploy configuration file with a purpose much like that of development.ini. However, it disables the debug toolbar, and filters all log messages except those above the WARN level. It also turns off template development options such that templates are not automatically reloaded when changed, and turns off all debugging options. This file is appropriate to use instead of development.ini when you put your application into production.

It’s important to use production.ini (and not development.ini) to benchmark your application and put it into production. development.ini configures your system with a debug toolbar that helps development, but the inclusion of this toolbar slows down page rendering times by over an order of magnitude. The debug toolbar is also a potential security risk if you have it configured incorrectly.

3)
MANIFEST.in
==========
a)

The MANIFEST.in file is a distutils configuration file which specifies the non-Python files that should be included when a distribution of your Pyramid project is created when you run python setup.py sdist. Due to the information contained in the default MANIFEST.in, an sdist of your Pyramid project will include .txt files, .ini files, .rst files, graphics files, and template files, as well as .py files.

4)
setup.py
=======

a)
The setup.py file is a setuptools setup file. It is meant to be run directly from the command line to perform a variety of functions, such as testing your application, packaging, and distributing your application.
The setup.py file calls the setuptools setup function, which does various things depending on the arguments passed to setup.py on the command line.

b)

Usually you only need to think about the contents of the setup.py file when distributing your application to other people, when adding Python package dependencies, or when versioning your application for your own use. For fun, you can try this command now:

$ python setup.py sdist

This will create a tarball of your application in a dist subdirectory named MyProject-0.1.tar.gz. You can send this tarball to other people who want to install and use your application.

http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/project.html

No comments:

Post a Comment