mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Mark up files & directories
This commit is contained in:
@@ -38,7 +38,7 @@ server.
|
||||
run('git pull')
|
||||
run('touch app.wsgi')
|
||||
|
||||
With the previous code saved in a file named fabfile.py, we can check memory
|
||||
With the previous code saved in a file named :file:`fabfile.py`, we can check memory
|
||||
usage with:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
@@ -60,7 +60,7 @@ Requests whether this particular changeset breaks the build or not. So if you ar
|
||||
hosting your code on Github, travis-ci is a great and easy way to get started with
|
||||
Continuous Integration.
|
||||
|
||||
In order to get started, add a ``.travis.yml`` file to your repository with this
|
||||
In order to get started, add a :file:`.travis.yml` file to your repository with this
|
||||
example content::
|
||||
|
||||
language: python
|
||||
|
||||
@@ -150,8 +150,8 @@ to be compiled into C types while also creating a Python list:
|
||||
|
||||
What is the difference? In the upper Cython version you can see the declaration of the variable types and the integer array
|
||||
in a similar way like in standard C. For example `cdef int n,k,i` in line 3. This additional type declaration (e.g. integer)
|
||||
allows the Cython compiler to generate more efficient C code from the second code. While standard Python code is saved in `*.py` files,
|
||||
Cython code is saved in `*.pyx` files.
|
||||
allows the Cython compiler to generate more efficient C code from the second code. While standard Python code is saved in :file:`*.py` files,
|
||||
Cython code is saved in :file:`*.pyx` files.
|
||||
|
||||
And what is with the speed? So lets try it!
|
||||
|
||||
@@ -187,9 +187,9 @@ These both lines need a remark:
|
||||
pyximport.install()
|
||||
|
||||
|
||||
The `pyximport` module allows you to import `pyx` files (e.g., `primesCy.pyx`) with the Cython-compiled version of the `primes` function.
|
||||
The `pyximport` module allows you to import :file:`*.pyx` files (e.g., :file:`primesCy.pyx`) with the Cython-compiled version of the `primes` function.
|
||||
The `pyximport.install()` command allows the Python interpreter to start the Cython compiler directly to generate C-code,
|
||||
which is automatically compiled to a `*.so` C-library. Cython is able to import this library for you in your Python-code.
|
||||
which is automatically compiled to a :file:`*.so` C-library. Cython is able to import this library for you in your Python-code.
|
||||
Very easy and very efficient. With the `time.time()` function you are able to compare the time between this 2 different calls to find 500 prime numbers.
|
||||
On a standard notebook (dual core AMD E-450 1.6 GHz), the measured values are:
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ Gondor
|
||||
`Gondor <https://gondor.io/>`_ is a PaaS specialized for deploying Django
|
||||
and Pinax applications. Gondor supports Django versions 1.2 and 1.3 on
|
||||
Python version 2.7, and can automatically configure your Django site if you
|
||||
use ``local_settings.py`` for site-specific configuration information.
|
||||
use :file:`local_settings.py` for site-specific configuration information.
|
||||
|
||||
Gondor has a guide on deploying `Django projects <https://gondor.io/support/django/setup/>`_.
|
||||
|
||||
@@ -365,7 +365,7 @@ to use.
|
||||
application.listen(PORT)
|
||||
tornado.ioloop.IOLoop.instance().start()
|
||||
|
||||
The `base.html` file can be used as base for all site pages which are for example implemented in the content block.
|
||||
The :file:`base.html` file can be used as base for all site pages which are for example implemented in the content block.
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
@@ -389,8 +389,8 @@ The `base.html` file can be used as base for all site pages which are for exampl
|
||||
</body>
|
||||
|
||||
|
||||
The next listing is our site page (`site.html`) loaded in the Python app which extends `base.html`. The content block is
|
||||
automatically set into the corresponding block in the base.html page.
|
||||
The next listing is our site page (:file:`site.html`) loaded in the Python app which extends :file:`base.html`. The content block is
|
||||
automatically set into the corresponding block in the :file:`base.html` page.
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
|
||||
Reference in New Issue
Block a user