1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Added documentation, removed some options

This commit is contained in:
sam 2012-05-18 14:29:52 +02:00
parent 0d81a35a47
commit 97935e51d3
64 changed files with 2971 additions and 193 deletions

View File

@ -1,13 +1,21 @@
0bin
====
Have a try here: <a href="http://0bin.net">0bin.net</a>
0bin is a client side encrypted pastebin that can run without a database.
It allows anybody to host a pastebin while welcoming any type of content to be pasted in it. The idea is that one can (probably...) not be legally entitled to <a href="http://www.zdnet.com/blog/security/pastebin-to-hunt-for-hacker-pastes-anonymous-cries-censorship/11336">moderate the pastebin content</a> as he/she has no way to decrypt it.
* Try it: `0bin.net <http://0bin.net>`_
* Get the `source on github <https://github.com/sametmax/0bin>`_
* `Report a bug <https://github.com/sametmax/0bin/issues>`_
It's an Python implementation of the <a href="https://github.com/sebsauvage/ZeroBin/">zerobin project</a>. It's easy to install even if you know nothing about Python.
0bin allows anybody to host a pastebin while welcoming any type of content to
be pasted in it. The idea is that one can (probably...) not be legally entitled
to `moderate the pastebin content`_ as he/she has no way to decrypt it.
It's an Python implementation of the
`zerobin project`_. It's easy to
install even if you know nothing about Python.
For now tested with IE9, and the last opera, safari, chrome and FF.
How it works
=============
@ -33,17 +41,30 @@ Key points:
- all operations, including code coloration, must happens on the client;
- the server is no more than a fancy recipient for the encrypted data.
Other features
======================
- automatic code coloration (no need to specify);
- pastebin expiration: 1 day, 1 month or never;
- burn after reading: the paste is destroyed after the first reading;
- clone paste: you can't edit a paste, but you can duplicate any of them;
- code upload: if a file is too big, you can upload it instead of using copy/paste;
- copy paste to clipboard in a click;
- get paste short URL in a click;
- own previous pastes history;
- visual hash of a paste to easily tell it appart from others in a list.
Technologies used
==================
- <a href="https://en.wikipedia.org/wiki/Python_(programming_language)">Python</a>
- <a href="http://bottlepy.org/">The Bottle Python Web microframework</a>
- <a href="http://crypto.stanford.edu/sjcl/">SJCL</a> (js crypto tools)
- <a href="http://jquery.com/">jQuery</a>
- <a href="http://twitter.github.com/bootstrap/">Bootstrap</a>, the twitter css framework
- <a href="https://github.com/sametmax/VizHash.js">VizHash.js</a> to create visual hashes from pastes
- Cherrypy (server only)
- Python_
- `The Bottle Python Web microframework`_
- SJCL_ (js crypto tools)
- jQuery_
- Bootstrap_, the Twitter HTML5/CSS3 framework
- VizHash.js_ to create visual hashes from pastes
- Cherrypy_ (server only)
Known issues
============
@ -56,6 +77,18 @@ Known issues
What does 0bin not implement?
=================================
* Request throttling. It would be inefficient to do it at the app level, and web servers have robust implementations.
* Hash collision prevention: the ratio "probability it happens/consequence seriousness" <a href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions">is not worth it</a>
* Comments: for now. It's on the todo list.
* Request throttling. It would be inefficient to do it at the app level, and web servers have robust implementations for it.
* Hash collision prevention: the ratio "probability it happens/consequence seriousness" `is not worth it`_
* Comments: it was initially planed. But comes with a lot of issues so we chose to focus on lower handing fruits.
.. _moderate the pastebin content: http://www.zdnet.com/blog/security/pastebin-to-hunt-for-hacker-pastes-anonymous-cries-censorship/11336
.. _zerobin project: https://github.com/sebsauvage/ZeroBin/
.. _Python: https://en.wikipedia.org/wiki/Python_(programming_language)
.. _The Bottle Python Web microframework: http://bottlepy.org/
.. _SJCL: http://crypto.stanford.edu/sjcl/
.. _jQuery: http://jquery.com/
.. _Bootstrap: http://twitter.github.com/bootstrap/
.. _VizHash.js: https://github.com/sametmax/VizHash.js
.. _Cherrypy: http://www.cherrypy.org/ (server only)
.. _is not worth it: http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,39 @@
=========================
Installation with Apache
=========================
=============
Apache setup
=============
Apache is slower, heavier and more complicated to setup than Nginx. But it's also
much more famous:
- more people will be able to help you on forums;
- your hosting will most probably support Apache;
- the configuration file syntax is familiar to a lot of people.
An Apache setup is still much more robust and secure than an easy installation.
Une installation apache est aussi beaucoup plus solide et sécurisé qu'une
installation facile. You'll benefit from having:
- the possiblity to have several projects listening to the port 80;
- several Apache module at your disposal (like requests throttling);
- Apache robustness in front end: it's secure, and there is much less chance
it will crash under heavy load;
- your web site processes won't run with admin rights, even if --user doesn't
work on your OS.
Mod_wsgi
==========
The modern Web Python servers all work the same way, following an norm for
interfacing: WSGI.
This is the most performante solution, and the best to use. But it will require
the setup of the Apache module mod_wsgi. If you don't know how to do this, or
if you can't do it (E.G: your hosting won't let you), you need to go for
the CGI setup.
==========
This setup is considered as slow, but you will still benefit from Apache
robustness.

View File

@ -1,3 +1,58 @@
====================
Easiest installation
====================
====================
These solution are easy all will be able to handle a personnal website traffic.
For more robust and secure solutions, see Apache et Nginx setups.
10 seconds setup (if you know Python already)
===============================================
pip install zerobin
zerobin --host 0.0.0.0 --port 80 --compressed-static # as admin
30 seconds setup (for anybody)
===============================
- Make sure you have Python 2.6 or 2.7 (`python --version`)
- Download the last zip of the sources code.
- Extract all of it where you wish the site to be stored.
- Go to the extracted files.
- Run `python zerobin.py --host 0.0.0.0 --port 80 --compressed-static`
with the admin rights.
On ubuntu, this is a one liner::
wget stuff && unzip zerobin.zip && cd zerobin && sudo python zerobin.py --host 0.0.0.0 --port 80 --compressed-static
Check out for more configuration options.
Run 0bin in background
=======================
0bin doesn't come with something built in for this. You have several solutions:
For a small website:
Just make it a shell background process. E.G in GNU/Linux::
nohup python zerobin.py --host 0.0.0.0 --port 80 --compressed-static &
Or run it in a screen.
For a big Website:
- setup 0bin with Apache;
- setup 0bin with supervisord (best way to do it);
.. Note::
You can even use zerobin on your private local network from your laptop.
Make sure you firewall won't block the port, and run::
python zerobin.py --host 0.0.0.0 --port 8000
0bin will now be accessible from http://your.local.ip.address:8000.
This can be very cool way to share code in a companie or during a code sprint.

View File

@ -54,7 +54,7 @@ Technologies used
- `The Bottle Python Web microframework`_
- SJCL_ (js crypto tools)
- jQuery_
- Bootstrap_, the twitter HTML5/CSS3 framework
- Bootstrap_, the Twitter HTML5/CSS3 framework
- VizHash.js_ to create visual hashes from pastes
- Cherrypy_ (server only)
@ -62,7 +62,7 @@ Technologies used
Known issues
============
- 0bin use several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.
- 0bin uses several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.
- The "copy to clipboard" feature is buggy under linux. It's flash, so we won't fix it. Better wait for the HTML5 clipboard API to be implemented in major browsers.
- The pasted content size limit check is not accurate. It's just a safety net, so we thinks it's ok.
- Some url shorteners and other services storing URLs break the encryption key. We will sanitize the URL as much as we can, but there is a limit to what we can do.
@ -71,7 +71,7 @@ What does 0bin not implement?
=================================
* Request throttling. It would be inefficient to do it at the app level, and web servers have robust implementations for it.
* Hash collision: the ratio "probability it happens/consequence seriousness" <a href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions"is not worth it</a
* Hash collision prevention: the ratio "probability it happens/consequence seriousness" `is not worth it`_
* Comments: it was initially planed. But comes with a lot of issues so we chose to focus on lower handing fruits.
@ -83,4 +83,5 @@ What does 0bin not implement?
.. _jQuery: http://jquery.com/
.. _Bootstrap: http://twitter.github.com/bootstrap/
.. _VizHash.js: https://github.com/sametmax/VizHash.js
.. _Cherrypy: http://www.cherrypy.org/ (server only)
.. _Cherrypy: http://www.cherrypy.org/ (server only)
.. _is not worth it: http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions

View File

@ -1,3 +1,64 @@
========================
Installing with Nginx
========================
============
Nginx setup
============
Nginx is a very popular choice to serve a Python project:
- It's fast.
- It's lightweight.
- Configuration files are simple.
If you have your own server, it's the best choice. If not, try the easiest
setup, or the Apache setup.
Nginx doesn't run any Python process, it only serve requests from outside to
the Python server.
Therefor there are two steps:
- Run the Python process.
- Run Nginx.
You will benefit from having:
- the possiblity to have several projects listening to the port 80;
- several Apache module at your disposal (like requests throttling);
- Apache robustness in front end: it's secure, and there is much less chance
it will crash under heavy load;
- your web site processes won't run with admin rights, even if --user doesn't
work on your OS;
- the ability to manage a Python process without touching Nginx or the other
processes. It's very handy for updates.
The Python process
==================
Run 0bin as usual, but this time make it listen to a local port and host. E.G::
zerobin --host 127.0.0.1 --port 8000
In PHP, when you edit a file, the changes are immediatly visible. In Python,
the whole code is often loaded in memory for performance reasons. This means
you have to restart the Python process to see the changes effect. Having a
separate process let you do this without having to restart the server.
Nginx
======
Nginx can be installed with you usual package manager, so we won't cover
installing it.
Vous must create a Nginx configuration file for 0bin. On GNU/Linux, they usually
go into /etc/nginx/conf.d/. Name it zerobin.conf.
The minimal file to run the site is:
But you can make some adjustement to get better perfomances:

View File

@ -0,0 +1,218 @@
--host=STR
The host on which to listen for incomming request. Usually 127.0.0.1 to
listen locally or 0.0.0.0 to listen from the outside.
Default: 127.0.0.1
Setting file : HOST
============
Options
============
0bin's behavior can be adjusted with options passed using a configuration
file or directly using the command line. Some parameters are only available
in the configuration file.
If an option is not passed, 0bin will use the default value from the file
zerobin/default_settings.py.
Command line
==================
--host and --port
-------------------
The host and port on which to listen for incomming request. Usually 127.0.0.1
and 8000 to listen locally or 0.0.0.0 and 80 to listen from the outside.
Default: 127.0.0.1 and 8000
Setting file : HOST and PORT
--debug
----------
Display a listing of useful debugging information when something goes wrong
instead of showing the 500 error page.
In debug mode, the server also reload automatically any modified Python file;
Default: False
Configuration file equivalent: DEBUG
--user and --group
-------------------
The user and group the server will adopt after start up.
Useful when you run the command with admin rights to be able to listen to the
port 80, but you wish that the process do not have access to protected files.
--group is set to --user if not passed.
Default: None
Configuration file equivalent: USER and GROUP
--settings-file
-----------------
Path to the configuration file, if you use any.
Default: None
Configuration file equivalent: None
--compressed-static
--------------------
Serve minified static files (css and js). Use it in production to get a faster
web site.
Default: False
Configuration file equivalent: COMPRESSED_STATIC_FILES
--version and --help
--------------------
Display the help or the version of 0bin.
Default: None
Configuration file equivalent: None
Examples
----------
Production::
sudo zerobin --host 0.0.0.0 --port 80 --user foo --compressed-static
Developpement::
zerobin --debug --serve-static
Configuration file
====================
The configuration file should be an ordinary Python file, usually named
settings.py. It's used this way::
zerobin --settings-file '/path/to/settings.py'
Any options passed to the command line will have priority on the ones in
the configuration file. The zerobin/default_settings.py can be used as an
example to create your own file. It's heavily commented.
DEBUG
-----
Display a listing of useful debugging information when something goes wrong
instead of showing the 500 error page.
In debug mode, the server also reload automatically any modified Python file;
Default: False
Command line equivalent: --debug
STATIC_FILES_ROOT
------------------
Asbolute path to the directory where 0bin is going to look for static files
(css, js and images).
Default: "static" directory in the "zerobin" directory
Command line equivalent: None
COMPRESSED_STATIC_FILES
-------------------------
Serve minified static files (css and js). Use it in production to get a faster
web site.
Default: False
Command line equivalent: --compressed-static
PASTE_FILES_ROOT
-----------------
Absolute path to the directory in which 0bin is going to look save pastes.
Default: "static/content" direcotry in the "zerobin" directory
Command line equivalent: None
TEMPLATE_DIRS
--------------
List of absolute path to directories containing templates that 0bin uses to
generate the web site pages. The first list items have priotity on the later.
If you wish to use your own templates, add the directory containing them
at the begining of the list::
from zerobin.defauls_settings import TEMPLATE_DIRS
TEMPLATE_DIRS = (
'/directy/path/to/your/templates',
) + TEMPLATE_DIRS
Default: "view" directory in the "zerobin" directory
Command line equivalent: None
HOST and PORT
-------------------
The host and port on which to listen for incomming request. Usually 127.0.0.1
and 8000 to listen locally or 0.0.0.0 and 80 to listen from the outside.
Default: 127.0.0.1 and 8000
Configuration file equivalent: --host and --port
USER and GROUP
-------------------
The user and group the server will adopt after start up.
Useful when you run the command with admin rights to be able to listen to the
port 80, but you wish that the process do not have access to protected files.
GROUP is set to USER if not passed.
Default: None
Configuration file equivalent: --user and --group
MENU
------
A list of 'name' + 'link' pairs used to buld the menu at the top of each page.
You can use a relative or absolute link, and even an email address.
Any email address will be automatically protected against spam.
Default::
MENU = (
('Home', '/'),
('Download 0bin', 'https://github.com/sametmax/0bin'),
('Contact', 'mailto:your@email.com') # email
)
Command line equivalent: None
MAX_SIZE
---------
Approximative value for a paste size limite.
Valeur approximative de limite de taille d'un paste.
Default = 500000 octets (500 ko)
Command line equivalent: None

View File

@ -0,0 +1,3 @@
================================
Installation in a virtualenv
================================

View File

@ -1,3 +1,22 @@
=======
Theming
=======
=======
0bin comes a complete theming support, but for now it's not well ingrated.
If you wish to create your own theme, you'll need to create template similar
to the ones in zerobin/view, and add the path to the director containing them
to the settings file.
You'll also need to copy static files from zerobin/static to a new direcotry
where you can edit them. And you need to add this directory in the
settings file too.
Of course, if you look for something simple, you can just edit all files in place/
But be careful, the javascript code is tightly coupled with HTML ID and classes,
and they are not very well organized for now.
If you have serious theming needs, please contact us so we improve the support.

View File

@ -1,3 +1,42 @@
=========================
Installation avec Apache
=========================
=========================
Apache est plus lent, plus lourd, et plus complexe à mettre en oeuvre que Nginx.
Mais il est aussi beaucoup plus connu:
- plus de gens pourront vous aider les fora;
- votre hébergeur propose surement Apache;
- la syntaxe des fichiers de configuration est familière pour beaucoup.
Une installation apache est aussi beaucoup plus solide et sécurisé qu'une
installation facile. Vous bénéficierez:
- de la possibilité d'avoir plusieurs projets écoutant sur le prot 80;
- de plusieurs modules Apache à votre disposition (comme la limitation
du nombre de requêtes);
- de la solidité d'Apache en front end: il est sécurité, et il y a peu de chance
qu'il crash sous une forte charge;
- les processus de votre site ne tournent pas avec les droits admin, même si
--user ne fonctionne pas sur votre OS.
Apache s'installe avec votre gestionnaire de paquet habituel, nous ne couvrierons
pas cette partie.
Mod_wsgi
==========
Les serveurs Web Python modernes fonctionnent tous de la même manière, en suivant
une norme d'interfaçage: WSGI.
C'est la solution la plus performante, et celle recommandée. Mais elle demande
l'installation du modle Apache mod_wsgi. Si vous ne savez pas comment faire,
ou si vous ne pouvez pas le faire (par exemple sur un hébergement mutualisé
qui ne le propose pas), il vous faudra choisir l'installation CGI.
Mod_CGI
==========
Cette installation est considérée comme relativement lente. Mais vous bénéficierez
tout de même de la robustesse d'Apache

View File

@ -1,3 +1,62 @@
===========================
============================
Installation la plus simple
===========================
============================
Ces solutions sont simples et supportent le traffic d'un site web personnel.
Pour des solutions plus solides et sécurisées, essayez les installtion Apache
et Nginx.
Installation en 10 secondes (si vous connaissez Python)
========================================================
pip install zerobin
zerobin --host 0.0.0.0 --port 80 --compressed-static # en tant qu'admin
Installation en 30 secondes (pour tous)
=======================================
- Assurez-vous d'avoir Python 2.6 ou 2.7 (`python --version`)
- Télécharger le dernier zip du code source.
- Décompressez tous les fichiers là où vous souhaitez mettre le site.
- Allez dans les dossiers extraits.
- Lancez `python zerobin.py --host 0.0.0.0 --port 80 --compressed-static`
avec les droits admin.
Sous ubuntu, une line suffit::
wget stuff && unzip zerobin.zip && cd zerobin && sudo python zerobin.py --host 0.0.0.0 --port 80 --compressed-static
Jetez un oeil aux options de configuration.
Faire tourner 0bin en arrière plan
==================================
0bin ne vient pas avec un moyen intégré pour le faire. Il y a plusieurs
solutions:
Pour un petit site:
Lancer simplement 0bin en processus shell d'arrière plan. Exemple sous GNU/Linux::
nohup python zerobin.py --host 0.0.0.0 --port 80 --compressed-static &
Ou dans un screen.
Pour les gros sites Web:
- configurer 0bin et Apache;
- configure 0bin avec supervisord (recommandé).
.. Note::
Vous pouvez même utiliser zerobin sur votre réseau local depuis votre portable.
Assurez vous que votre parefeu ne bloque pas le port, et lancez::
python zerobin.py --host 0.0.0.0 --port 8000
0bin sera maintenant accessible sur http://your.local.ip.address:8000.
Ça peut être très un moyen très cool pour partager du code dans une entreprise
ou a un code sprint.

View File

@ -7,7 +7,7 @@ quel type de contenu y soit posté. L'idée est qu'une personne ne peut (probabl
pas être tenue de `modérer le contenu du pastebin`_ si elle n'a aucun moyen
de le déchiffrer.
C'est une implémentation en Python du `projet zerobin`, facile à installer même
C'est une implémentation en Python du `projet zerobin`_, facile à installer même
si on ne connait pas ce langage.
Comment ça marche
@ -56,25 +56,37 @@ Technologies utilisées
- `The Bottle Python Web microframework`_
- SJCL_ (js crypto tools)
- jQuery_
- Bootstrap_, the twitter HTML5/CSS3 framework
- VizHash.js_ to create visual hashes from pastes
- Cherrypy_ (server only)
- Bootstrap_, le framework HTML5/CSS3 de Twitter
- VizHash.js_ pour créer les hash visuels des pastes
- Cherrypy_ (serveur uniquement)
Problèmes connus
=================
- 0bin use several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.
- The "copy to clipboard" feature is buggy under linux. It's flash, so we won't fix it. Better wait for the HTML5 clipboard API to be implemented in major browsers.
- The pasted content size limit check is not accurate. It's just a safety net, so we thinks it's ok.
- Some url shorteners and other services storing URLs break the encryption key. We will sanitize the URL as much as we can, but there is a limit to what we can do.
- 0bin utilise plusieurs fonctionalités HTML5/CSS3 qui ne sont pas
encore largement supporté. Dans ce cas nous gérons la dégradation le plus
gracieusement possible.
- La fonction "copier dans le press/papier" est buggée sous Linux. C'est du
flash donc nous ne le réparerons pas. Il vaut mieux attendre le support
du presse papier via l'API HTML5.
- La vérification de la limite de ta taille du paste n'est pas précise. c'est
juste un filet de sécurité, donc nous pensons que ça suffira.
- Quelques raccourcisseurs d'URL et d'autres services cassent la clé de
chiffrement. Nous essayerons de nettoyer autant que possible mais il y
a une limite à ce que nous pouvons faire.
What does 0bin not implement?
Qu'est-ce que 0bin ne fait pas ?
=================================
* Request throttling. It would be inefficient to do it at the app level, and web servers have robust implementations for it.
* Hash collision: the ratio "probability it happens/consequence seriousness" <a href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions"is not worth it</a
* Comments: it was initially planed. But comes with a lot of issues so we chose to focus on lower handing fruits.
- Limitation du nombre de requêtes: ce serait peu productif de le faire au
niveau de l'application alors que les serveurs Web le font tous de manière très
efficace.
- La prévention de collision de hash: le ratio "occurence/conséquence"
n'est pas suffisant_.
- Commentaires: c'était prévu. Mais il y a beaucoup de contraintes associées,
nous avons donc choisi de nous concentrer sur les fonctions avec un meilleur
rapport qualité/prix.
.. _modérer le contenu du pastebin: http://linuxfr.org/news/zerobin-un-pastebin-securise
@ -85,4 +97,5 @@ What does 0bin not implement?
.. _jQuery: http://jquery.com/
.. _Bootstrap: http://twitter.github.com/bootstrap/
.. _VizHash.js: https://github.com/sametmax/VizHash.js
.. _Cherrypy: http://www.cherrypy.org/ (server only)
.. _Cherrypy: http://www.cherrypy.org/ (server only)
.. _suffisant: http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions

View File

@ -1,3 +1,67 @@
========================
Installation avec Nginx
========================
========================
Nginx est un choix très populaire pour servir un projet Python:
- Il est rapide.
- Il est léger.
- Les fichiers de configuration sont très simple.
Si vous avez votre propre serveur, c'est le meilleur choix. Dans le cas contraire,
essayez l'installation la plus simple, ou avec Apache.
Nginx ne lance aucun processus Python, il sert uniquement les requêtes
depuis l'extérieur vers le server Python.
Il y a donc deux étapes:
- Faire tourner le processus Python.
- Faire tourner Nginx.
Ainsi, vous bénéficierez:
- de la possibilité d'avoir plusieurs projets écoutant sur le prot 80;
- de plusieurs modules Nginx à votre disposition (comme la limitation
du nombre de requêtes);
- de la solidité de Nginx en front end: il est sécurité, et il y a peu de chance
qu'il crash sous une forte charge;
- les processus de votre site ne tournent pas avec les droits admin, même si
--user ne fonctionne pas sur votre OS;
- de la capacité de gérer un processus Python sans toucher Nginx ou les autres
processus. C'est très pratique pour les mises à jour.
Processus Python
==================
Lancez 0bin comme d'habitude, mais cette fois pour écouter sur un host et un port
local. Ex ::
zerobin --host 127.0.0.1 --port 8000
En PHP, quand on édite un fichier, la modificiation est visible immédiatement.
En Python, l'intégralité du code est chargé en mémoire pour des raisons de
performance. Pour cette raison, il faut redémarrer le processus Python pour voir
les changement prendre effet. Avoir un processus séparé permet de le faire
sans avoir à redémarer le serveur.
Nginx
======
Nginx peut être installé avec votre gestionnaire de paquets habituels, donc
nous ne couvrirons pas cette partie.
Vous devez créer une fichier de configuration Nginx pour 0bin. Sous GNU/Linux,
on les mets en général dans /etc/nginx/conf.d/. Nommez le zerobin.conf.
Le fichier minimal pour faire tourner le site est:
Mais on peut apporter plusieurs améliorations de performance:

View File

@ -0,0 +1,209 @@
============
Options
============
Le comportement de 0bin peut être ajusté à l'aide d'options passées depuis un
fichier de configuration ou directement à la ligne de commande. Certains
paramètres sont uniquement disponibles dans le fichier de configuration.
Si une option n'est pas passée, 0bin utilise la valeur par
défaut présente dans le fichier zerobin/default_settings.py.
Ligne de commande
==================
--host et --port
-------------------
L'hôte et le port sur lesquels écouter les requêtes entrantes. En général
127.0.0.1 et 8000 pour écouter localement, ou 0.0.0.0 et 80 pour
écouter les requêtes extérieures.
Défaut: 127.0.0.1 et 8000
Equivalent du fichier de configuration : HOST et PORT
--debug
----------
Afffiche un listing d'informations utiles pour déboguer quand quelque chose
se passe mal à la place d'une page d'erreur 500.
En mode debug, le serveur recharge aussi automatiquement tout fichier Python
modifié.
Défaut: False
Equivalent du fichier de configuration : DEBUG
--user et --group
-------------------
L'utilisateur et le group que le serveur essayera d'adopter après le démarrage.
Utile quand on lance la commande avec les droits admin afin de pouvoir
écouter sur le port 80, mais qu'on souhaite, pour des raisons de sécurité, que
le processus n'est pas accès aux fichiers protégés du système.
--group prend de --user si il n'est pas précisé.
Défaut: Aucun
Equivalent du fichier de configuration : USER et GROUP
--settings-file
-----------------
Chemin vers le fichier de configuration, si vous souhaitez en utiliser un.
Défaut: Aucun
Equivalent du fichier de configuration : Aucun
--compressed-static
--------------------
Sert les versions minifiées fichiers statiques (css et js). A utiliser en
production pour un site plus rapide.
Défaut: False
Equivalent du fichier de configuration : COMPRESSED_STATIC_FILES
--version et --help
--------------------
Affiche l'aide ou la version de 0bin
Défaut: Aucun
Equivalent du fichier de configuration : Aucun
Exemples
----------
Production::
sudo zerobin --host 0.0.0.0 --port 80 --user foo --compressed-static
Développement::
zerobin --debug --serve-static
Fichier de configuration
========================
Le fichier configuration doit être un fichier Python ordinnaire, généralement
appelé settings.py. On l'utilise ainsi::
zerobin --settings-file '/chemin/vers/settings.py'
Toutes les autres options passées à la commandes auront priorité sur les options
du fichier de configuration. Le fichier zerobin/default_settings.py peut servir
d'exemple pour créer son propre fichier de configuration, il est largement commenté.
DEBUG
-----
Afffiche un listing d'informations utiles pour déboguer quand quelque chose
se passe mal à la place d'une page d'erreur 500.
En mode debug, le serveur recharge aussi automatiquement tout fichier Python
modifié.
Défaut: False
Equivalent en ligne de commande : --debug
STATIC_FILES_ROOT
------------------
Chemin absolu du dossier dans lequel 0bin va chercher les fichiers statiques
(css, js et images).
Défaut: dossier "static" dans le dossier "zerobin"
Equivalent en ligne de commande : Aucun
COMPRESSED_STATIC_FILES
-------------------------
Sert les versions minifiées fichiers statiques (css et js). A utiliser en
production pour un site plus rapide.
Défaut: False
Equivalent en ligne de commande : --compressed-static
PASTE_FILES_ROOT
-----------------
Chemin absolu du dossier dans lequel 0bin va sauvegarder les pastes.
Défaut: dossier "static/content" dans le dossier "zerobin"
Equivalent en ligne de commande : Aucun
TEMPLATE_DIRS
--------------
Liste des chemins absolus des dossiers qui contiennent les templates que 0bin
utilise pour générer les pages du site. Les premiers éléments de la liste
ont priorités sur les suivant.
Si vous voulez utiliser vos propres templates, ajoutez le dossier qui les
contient au début de la liste::
from zerobin.defauls_settings import TEMPLATE_DIRS
TEMPLATE_DIRS = (
'/chemin/version/votre/dossier/de/templates',
) + TEMPLATE_DIRS
Défaut: dossier "view" dans le dossier "zerobin"
Equivalent en ligne de commande : Aucun
HOST et PORT
-------------------
L'hôte et le port sur lesquels écouter les requêtes entrantes. En général
127.0.0.1 et 8000 pour écouter localement, ou 0.0.0.0 et 80 pour
écouter les requêtes extérieures.
Défaut: 127.0.0.1 et 8000
Equivalent du fichier de configuration : --host et --port
USER et GROUP
-------------------
L'utilisateur et le group que le serveur essayera d'adopter après le démarrage.
Utile quand on lance la commande avec les droits admin afin de pouvoir
écouter sur le port 80, mais qu'on souhaite, pour des raisons de sécurité, que
le processus n'est pas accès au fichiers système.
GROUP prend de USER si il n'est pas précisé.
Défaut: Aucun
Equivalent du fichier de configuration : --user et --group
MENU
------
Une liste de paires 'Nom' + 'Liens' à utiliser pour construire le menu qui
est en haut de chaque page.
Le lien peut être un lien relatif, absolu, ou une adresse email.
Toute addresse email sera automatiquement protégée contre le spam.
Défaut::
MENU = (
('Home', '/'),
('Download 0bin', 'https://github.com/sametmax/0bin'),
('Contact', 'mailto:your@email.com') # email
)
Equivalent en ligne de commande : Aucun
MAX_SIZE
---------
Valeur approximative de limite de taille d'un paste.
Défaut = 500000 octets (500 ko)
Equivalent en ligne de commande : Aucun

View File

@ -0,0 +1,3 @@
================================
Installation dans un virtualenv
================================

View File

@ -1,3 +1,22 @@
=========================
Personnaliser l'apparence
=========================
=========================
0bin possède un support de theming complet, mais pour le moment mal intégré.
Si vous souhaitez créer votre propre theme, il vous faut créer des templates
similaires à ceux par défault présents dans zerobin/view, et
ajouter le chemin du dossier contenant ces templates au fichier de settings.
Vous aurez également besoin de copier les fichiers statiques présent
dans zerobin/static dans un nouveau dossier, puis les modifier. Et signifier
que vous utilisez ce dossier dans le fichiers de settings.
Vous pouvez bien entendu également éditez tous les fichier directement par
souci de simplicité.
Attention cependant, le code javascript est très dépendant des ID et classes
du HTML, qui ne sont pour le moment pas très bien organisés.
Si vous avez de sérieux besoin de theming, contactez-nous, afin que nous
améliorons le support.

View File

@ -1,8 +1,3 @@
.. 0bin documentation master file, created by
sphinx-quickstart on Mon May 7 13:31:25 2012.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
0bin's documentation
======================
@ -10,26 +5,26 @@
* Try it: `0bin.net <http://0bin.net>`_
* Get the `source on github <https://github.com/sametmax/0bin>`_
* `Report a bug <https://github.com/sametmax/0bin/issues>`_
.. http://www.sensefulsolutions.com/2010/10/format-text-as-table.html
+-------------------------+----------------------------+
| English | Français |
+-------------------------+----------------------------+
| | |
|.. toctree:: |.. toctree:: |
| :maxdepth: 1 | :maxdepth: 1 |
| | |
| en/intro | fr/intro |
| en/easy_install | fr/easy_install |
| en/apache_install | fr/apache_install |
| en/nginx_install | fr/nginx_install |
| en/using_supervisor | fr/using_supervisor |
| en/theming | fr/theming |
| | |
| |`Signaler un bug`_ |
+-------------------------+----------------------------+
+-------------------------+--------------------------------+
| English | Français |
+-------------------------+--------------------------------+
| | |
|.. toctree:: |.. toctree:: |
| :maxdepth: 1 | :maxdepth: 1 |
| | |
| en/intro | fr/intro |
| en/easy_install | fr/easy_install |
| en/apache_install | fr/apache_install |
| en/nginx_install | fr/nginx_install |
| en/using_supervisor | fr/using_supervisor |
| en/theming | fr/theming |
| en/options | fr/options |
| | |
|`Report a bug`_ |`Signaler un bug`_ |
+-------------------------+--------------------------------+
Indices and tables
@ -39,4 +34,5 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`
.. _Signaler un bug: https://github.com/sametmax/0bin/issues
.. _Signaler un bug: https://github.com/sametmax/0bin/issues
.. _Report a bug: <https://github.com/sametmax/0bin/issues>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installation with Apache &mdash; 0bin 0.1 documentation</title>
<title>Apache setup &mdash; 0bin 0.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@ -26,8 +26,8 @@
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Installing with Nginx" href="nginx_install.html" />
<link rel="prev" title="&lt;no title&gt;" href="easy_install.html" />
<link rel="next" title="Nginx setup" href="nginx_install.html" />
<link rel="prev" title="Easiest installation" href="easy_install.html" />
</head>
<body>
<div class="related">
@ -37,10 +37,10 @@
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="nginx_install.html" title="Installing with Nginx"
<a href="nginx_install.html" title="Nginx setup"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="easy_install.html" title="&lt;no title&gt;"
<a href="easy_install.html" title="Easiest installation"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
@ -51,8 +51,38 @@
<div class="bodywrapper">
<div class="body">
<div class="section" id="installation-with-apache">
<h1>Installation with Apache<a class="headerlink" href="#installation-with-apache" title="Permalink to this headline"></a></h1>
<div class="section" id="apache-setup">
<h1>Apache setup<a class="headerlink" href="#apache-setup" title="Permalink to this headline"></a></h1>
<p>Apache is slower, heavier and more complicated to setup than Nginx. But it&#8217;s also
much more famous:</p>
<ul class="simple">
<li>more people will be able to help you on forums;</li>
<li>your hosting will most probably support Apache;</li>
<li>the configuration file syntax is familiar to a lot of people.</li>
</ul>
<p>An Apache setup is still much more robust and secure than an easy installation.</p>
<p>Une installation apache est aussi beaucoup plus solide et sécurisé qu&#8217;une
installation facile. You&#8217;ll benefit from having:</p>
<ul class="simple">
<li>the possiblity to have several projects listening to the port 80;</li>
<li>several Apache module at your disposal (like requests throttling);</li>
<li>Apache robustness in front end: it&#8217;s secure, and there is much less chance
it will crash under heavy load;</li>
<li>your web site processes won&#8217;t run with admin rights, even if &#8211;user doesn&#8217;t
work on your OS.</li>
</ul>
<div class="section" id="mod-wsgi">
<h2>Mod_wsgi<a class="headerlink" href="#mod-wsgi" title="Permalink to this headline"></a></h2>
<p>The modern Web Python servers all work the same way, following an norm for
interfacing: WSGI.</p>
<p>This is the most performante solution, and the best to use. But it will require
the setup of the Apache module mod_wsgi. If you don&#8217;t know how to do this, or
if you can&#8217;t do it (E.G: your hosting won&#8217;t let you), you need to go for
the CGI setup.</p>
<hr class="docutils" />
<p>This setup is considered as slow, but you will still benefit from Apache
robustness.</p>
</div>
</div>
@ -61,12 +91,20 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Apache setup</a><ul>
<li><a class="reference internal" href="#mod-wsgi">Mod_wsgi</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="easy_install.html"
title="previous chapter">&lt;no title&gt;</a></p>
title="previous chapter">Easiest installation</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="nginx_install.html"
title="next chapter">Installing with Nginx</a></p>
title="next chapter">Nginx setup</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/en/apache_install.txt"
@ -96,10 +134,10 @@
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="nginx_install.html" title="Installing with Nginx"
<a href="nginx_install.html" title="Nginx setup"
>next</a> |</li>
<li class="right" >
<a href="easy_install.html" title="&lt;no title&gt;"
<a href="easy_install.html" title="Easiest installation"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>

View File

@ -26,7 +26,7 @@
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Installation with Apache" href="apache_install.html" />
<link rel="next" title="Apache setup" href="apache_install.html" />
<link rel="prev" title="Introduction" href="intro.html" />
</head>
<body>
@ -37,7 +37,7 @@
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="apache_install.html" title="Installation with Apache"
<a href="apache_install.html" title="Apache setup"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="intro.html" title="Introduction"
@ -53,6 +53,51 @@
<div class="section" id="easiest-installation">
<h1>Easiest installation<a class="headerlink" href="#easiest-installation" title="Permalink to this headline"></a></h1>
<p>These solution are easy all will be able to handle a personnal website traffic.
For more robust and secure solutions, see Apache et Nginx setups.</p>
<div class="section" id="seconds-setup-if-you-know-python-already">
<h2>10 seconds setup (if you know Python already)<a class="headerlink" href="#seconds-setup-if-you-know-python-already" title="Permalink to this headline"></a></h2>
<p>pip install zerobin
zerobin &#8211;host 0.0.0.0 &#8211;port 80 &#8211;compressed-static # as admin</p>
</div>
<div class="section" id="seconds-setup-for-anybody">
<h2>30 seconds setup (for anybody)<a class="headerlink" href="#seconds-setup-for-anybody" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Make sure you have Python 2.6 or 2.7 (<cite>python &#8211;version</cite>)</li>
<li>Download the last zip of the sources code.</li>
<li>Extract all of it where you wish the site to be stored.</li>
<li>Go to the extracted files.</li>
<li>Run <cite>python zerobin.py &#8211;host 0.0.0.0 &#8211;port 80 &#8211;compressed-static</cite>
with the admin rights.</li>
</ul>
<p>On ubuntu, this is a one liner:</p>
<div class="highlight-python"><pre>wget stuff &amp;&amp; unzip zerobin.zip &amp;&amp; cd zerobin &amp;&amp; sudo python zerobin.py --host 0.0.0.0 --port 80 --compressed-static</pre>
</div>
<p>Check out for more configuration options.</p>
</div>
<div class="section" id="run-0bin-in-background">
<h2>Run 0bin in background<a class="headerlink" href="#run-0bin-in-background" title="Permalink to this headline"></a></h2>
<p>0bin doesn&#8217;t come with something built in for this. You have several solutions:</p>
<p>For a small website:</p>
<p>Just make it a shell background process. E.G in GNU/Linux:</p>
<div class="highlight-python"><pre>nohup python zerobin.py --host 0.0.0.0 --port 80 --compressed-static &amp;</pre>
</div>
<p>Or run it in a screen.</p>
<p>For a big Website:</p>
<ul class="simple">
<li>setup 0bin with Apache;</li>
<li>setup 0bin with supervisord (best way to do it);</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>You can even use zerobin on your private local network from your laptop.</p>
<p>Make sure you firewall won&#8217;t block the port, and run:</p>
<div class="highlight-python"><pre>python zerobin.py --host 0.0.0.0 --port 8000</pre>
</div>
<p>0bin will now be accessible from <a class="reference external" href="http://your.local.ip.address:8000">http://your.local.ip.address:8000</a>.</p>
<p class="last">This can be very cool way to share code in a companie or during a code sprint.</p>
</div>
</div>
</div>
@ -61,12 +106,22 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Easiest installation</a><ul>
<li><a class="reference internal" href="#seconds-setup-if-you-know-python-already">10 seconds setup (if you know Python already)</a></li>
<li><a class="reference internal" href="#seconds-setup-for-anybody">30 seconds setup (for anybody)</a></li>
<li><a class="reference internal" href="#run-0bin-in-background">Run 0bin in background</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="intro.html"
title="previous chapter">Introduction</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="apache_install.html"
title="next chapter">Installation with Apache</a></p>
title="next chapter">Apache setup</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/en/easy_install.txt"
@ -96,7 +151,7 @@
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="apache_install.html" title="Installation with Apache"
<a href="apache_install.html" title="Apache setup"
>next</a> |</li>
<li class="right" >
<a href="intro.html" title="Introduction"

View File

@ -104,7 +104,7 @@ install even if you know nothing about Python.</p>
<li><a class="reference external" href="http://bottlepy.org/">The Bottle Python Web microframework</a></li>
<li><a class="reference external" href="http://crypto.stanford.edu/sjcl/">SJCL</a> (js crypto tools)</li>
<li><a class="reference external" href="http://jquery.com/">jQuery</a></li>
<li><a class="reference external" href="http://twitter.github.com/bootstrap/">Bootstrap</a>, the twitter HTML5/CSS3 framework</li>
<li><a class="reference external" href="http://twitter.github.com/bootstrap/">Bootstrap</a>, the Twitter HTML5/CSS3 framework</li>
<li><a class="reference external" href="https://github.com/sametmax/VizHash.js">VizHash.js</a> to create visual hashes from pastes</li>
<li><a class="reference external" href="http://www.cherrypy.org/(serveronly)">Cherrypy</a> (server only)</li>
</ul>
@ -112,7 +112,7 @@ install even if you know nothing about Python.</p>
<div class="section" id="known-issues">
<h2>Known issues<a class="headerlink" href="#known-issues" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>0bin use several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.</li>
<li>0bin uses several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.</li>
<li>The &#8220;copy to clipboard&#8221; feature is buggy under linux. It&#8217;s flash, so we won&#8217;t fix it. Better wait for the HTML5 clipboard API to be implemented in major browsers.</li>
<li>The pasted content size limit check is not accurate. It&#8217;s just a safety net, so we thinks it&#8217;s ok.</li>
<li>Some url shorteners and other services storing URLs break the encryption key. We will sanitize the URL as much as we can, but there is a limit to what we can do.</li>
@ -122,7 +122,7 @@ install even if you know nothing about Python.</p>
<h2>What does 0bin not implement?<a class="headerlink" href="#what-does-0bin-not-implement" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Request throttling. It would be inefficient to do it at the app level, and web servers have robust implementations for it.</li>
<li>Hash collision: the ratio &#8220;probability it happens/consequence seriousness&#8221; &lt;a href=&#8221;<a class="reference external" href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions">http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions</a>&#8220;is not worth it&lt;/a</li>
<li>Hash collision prevention: the ratio &#8220;probability it happens/consequence seriousness&#8221; <a class="reference external" href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions">is not worth it</a></li>
<li>Comments: it was initially planed. But comes with a lot of issues so we chose to focus on lower handing fruits.</li>
</ul>
</div>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installing with Nginx &mdash; 0bin 0.1 documentation</title>
<title>Nginx setup &mdash; 0bin 0.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@ -27,7 +27,7 @@
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Using supervisor" href="using_supervisor.html" />
<link rel="prev" title="Installation with Apache" href="apache_install.html" />
<link rel="prev" title="Apache setup" href="apache_install.html" />
</head>
<body>
<div class="related">
@ -40,7 +40,7 @@
<a href="using_supervisor.html" title="Using supervisor"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="apache_install.html" title="Installation with Apache"
<a href="apache_install.html" title="Apache setup"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
@ -51,8 +51,53 @@
<div class="bodywrapper">
<div class="body">
<div class="section" id="installing-with-nginx">
<h1>Installing with Nginx<a class="headerlink" href="#installing-with-nginx" title="Permalink to this headline"></a></h1>
<div class="section" id="nginx-setup">
<h1>Nginx setup<a class="headerlink" href="#nginx-setup" title="Permalink to this headline"></a></h1>
<p>Nginx is a very popular choice to serve a Python project:</p>
<ul class="simple">
<li>It&#8217;s fast.</li>
<li>It&#8217;s lightweight.</li>
<li>Configuration files are simple.</li>
</ul>
<p>If you have your own server, it&#8217;s the best choice. If not, try the easiest
setup, or the Apache setup.</p>
<p>Nginx doesn&#8217;t run any Python process, it only serve requests from outside to
the Python server.</p>
<p>Therefor there are two steps:</p>
<ul class="simple">
<li>Run the Python process.</li>
<li>Run Nginx.</li>
</ul>
<p>You will benefit from having:</p>
<ul class="simple">
<li>the possiblity to have several projects listening to the port 80;</li>
<li>several Apache module at your disposal (like requests throttling);</li>
<li>Apache robustness in front end: it&#8217;s secure, and there is much less chance
it will crash under heavy load;</li>
<li>your web site processes won&#8217;t run with admin rights, even if &#8211;user doesn&#8217;t
work on your OS;</li>
<li>the ability to manage a Python process without touching Nginx or the other
processes. It&#8217;s very handy for updates.</li>
</ul>
<div class="section" id="the-python-process">
<h2>The Python process<a class="headerlink" href="#the-python-process" title="Permalink to this headline"></a></h2>
<p>Run 0bin as usual, but this time make it listen to a local port and host. E.G:</p>
<div class="highlight-python"><pre>zerobin --host 127.0.0.1 --port 8000</pre>
</div>
<p>In PHP, when you edit a file, the changes are immediatly visible. In Python,
the whole code is often loaded in memory for performance reasons. This means
you have to restart the Python process to see the changes effect. Having a
separate process let you do this without having to restart the server.</p>
</div>
<div class="section" id="nginx">
<h2>Nginx<a class="headerlink" href="#nginx" title="Permalink to this headline"></a></h2>
<p>Nginx can be installed with you usual package manager, so we won&#8217;t cover
installing it.</p>
<p>Vous must create a Nginx configuration file for 0bin. On GNU/Linux, they usually
go into /etc/nginx/conf.d/. Name it zerobin.conf.</p>
<p>The minimal file to run the site is:</p>
<p>But you can make some adjustement to get better perfomances:</p>
</div>
</div>
@ -61,9 +106,18 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Nginx setup</a><ul>
<li><a class="reference internal" href="#the-python-process">The Python process</a></li>
<li><a class="reference internal" href="#nginx">Nginx</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="apache_install.html"
title="previous chapter">Installation with Apache</a></p>
title="previous chapter">Apache setup</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="using_supervisor.html"
title="next chapter">Using supervisor</a></p>
@ -99,7 +153,7 @@
<a href="using_supervisor.html" title="Using supervisor"
>next</a> |</li>
<li class="right" >
<a href="apache_install.html" title="Installation with Apache"
<a href="apache_install.html" title="Apache setup"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>

View File

@ -0,0 +1,299 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Options &mdash; 0bin 0.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Introduction" href="../fr/intro.html" />
<link rel="prev" title="Theming" href="theming.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../fr/intro.html" title="Introduction"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="theming.html" title="Theming"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<p>&#8211;host=STR</p>
<p>The host on which to listen for incomming request. Usually 127.0.0.1 to
listen locally or 0.0.0.0 to listen from the outside.</p>
<p>Default: 127.0.0.1
Setting file : HOST</p>
<div class="section" id="options">
<h1>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h1>
<p>0bin&#8217;s behavior can be adjusted with options passed using a configuration
file or directly using the command line. Some parameters are only available
in the configuration file.</p>
<p>If an option is not passed, 0bin will use the default value from the file
zerobin/default_settings.py.</p>
<div class="section" id="command-line">
<h2>Command line<a class="headerlink" href="#command-line" title="Permalink to this headline"></a></h2>
<div class="section" id="host-and-port">
<h3>&#8211;host and &#8211;port<a class="headerlink" href="#host-and-port" title="Permalink to this headline"></a></h3>
<p>The host and port on which to listen for incomming request. Usually 127.0.0.1
and 8000 to listen locally or 0.0.0.0 and 80 to listen from the outside.</p>
<p>Default: 127.0.0.1 and 8000
Setting file : HOST and PORT</p>
</div>
<div class="section" id="debug">
<h3>&#8211;debug<a class="headerlink" href="#debug" title="Permalink to this headline"></a></h3>
<p>Display a listing of useful debugging information when something goes wrong
instead of showing the 500 error page.</p>
<p>In debug mode, the server also reload automatically any modified Python file;</p>
<p>Default: False
Configuration file equivalent: DEBUG</p>
</div>
<div class="section" id="user-and-group">
<h3>&#8211;user and &#8211;group<a class="headerlink" href="#user-and-group" title="Permalink to this headline"></a></h3>
<p>The user and group the server will adopt after start up.</p>
<p>Useful when you run the command with admin rights to be able to listen to the
port 80, but you wish that the process do not have access to protected files.</p>
<p>&#8211;group is set to &#8211;user if not passed.</p>
<p>Default: None
Configuration file equivalent: USER and GROUP</p>
</div>
<div class="section" id="settings-file">
<h3>&#8211;settings-file<a class="headerlink" href="#settings-file" title="Permalink to this headline"></a></h3>
<p>Path to the configuration file, if you use any.</p>
<p>Default: None
Configuration file equivalent: None</p>
</div>
<div class="section" id="compressed-static">
<h3>&#8211;compressed-static<a class="headerlink" href="#compressed-static" title="Permalink to this headline"></a></h3>
<p>Serve minified static files (css and js). Use it in production to get a faster
web site.</p>
<p>Default: False
Configuration file equivalent: COMPRESSED_STATIC_FILES</p>
</div>
<div class="section" id="version-and-help">
<h3>&#8211;version and &#8211;help<a class="headerlink" href="#version-and-help" title="Permalink to this headline"></a></h3>
<p>Display the help or the version of 0bin.</p>
<p>Default: None
Configuration file equivalent: None</p>
</div>
<div class="section" id="examples">
<h3>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h3>
<p>Production:</p>
<div class="highlight-python"><pre>sudo zerobin --host 0.0.0.0 --port 80 --user foo --compressed-static</pre>
</div>
<p>Developpement:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">zerobin</span> <span class="o">--</span><span class="n">debug</span> <span class="o">--</span><span class="n">serve</span><span class="o">-</span><span class="n">static</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="configuration-file">
<h2>Configuration file<a class="headerlink" href="#configuration-file" title="Permalink to this headline"></a></h2>
<p>The configuration file should be an ordinary Python file, usually named
settings.py. It&#8217;s used this way:</p>
<div class="highlight-python"><pre>zerobin --settings-file '/path/to/settings.py'</pre>
</div>
<p>Any options passed to the command line will have priority on the ones in
the configuration file. The zerobin/default_settings.py can be used as an
example to create your own file. It&#8217;s heavily commented.</p>
<div class="section" id="id1">
<h3>DEBUG<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<p>Display a listing of useful debugging information when something goes wrong
instead of showing the 500 error page.</p>
<p>In debug mode, the server also reload automatically any modified Python file;</p>
<p>Default: False
Command line equivalent: &#8211;debug</p>
</div>
<div class="section" id="static-files-root">
<h3>STATIC_FILES_ROOT<a class="headerlink" href="#static-files-root" title="Permalink to this headline"></a></h3>
<p>Asbolute path to the directory where 0bin is going to look for static files
(css, js and images).</p>
<p>Default: &#8220;static&#8221; directory in the &#8220;zerobin&#8221; directory
Command line equivalent: None</p>
</div>
<div class="section" id="compressed-static-files">
<h3>COMPRESSED_STATIC_FILES<a class="headerlink" href="#compressed-static-files" title="Permalink to this headline"></a></h3>
<p>Serve minified static files (css and js). Use it in production to get a faster
web site.</p>
<p>Default: False
Command line equivalent: &#8211;compressed-static</p>
</div>
<div class="section" id="paste-files-root">
<h3>PASTE_FILES_ROOT<a class="headerlink" href="#paste-files-root" title="Permalink to this headline"></a></h3>
<p>Absolute path to the directory in which 0bin is going to look save pastes.</p>
<p>Default: &#8220;static/content&#8221; direcotry in the &#8220;zerobin&#8221; directory
Command line equivalent: None</p>
</div>
<div class="section" id="template-dirs">
<h3>TEMPLATE_DIRS<a class="headerlink" href="#template-dirs" title="Permalink to this headline"></a></h3>
<p>List of absolute path to directories containing templates that 0bin uses to
generate the web site pages. The first list items have priotity on the later.</p>
<p>If you wish to use your own templates, add the directory containing them
at the begining of the list:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">zerobin.defauls_settings</span> <span class="kn">import</span> <span class="n">TEMPLATE_DIRS</span>
<span class="n">TEMPLATE_DIRS</span> <span class="o">=</span> <span class="p">(</span>
<span class="s">&#39;/directy/path/to/your/templates&#39;</span><span class="p">,</span>
<span class="p">)</span> <span class="o">+</span> <span class="n">TEMPLATE_DIRS</span>
</pre></div>
</div>
<p>Default: &#8220;view&#8221; directory in the &#8220;zerobin&#8221; directory
Command line equivalent: None</p>
</div>
<div class="section" id="id2">
<h3>HOST and PORT<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<p>The host and port on which to listen for incomming request. Usually 127.0.0.1
and 8000 to listen locally or 0.0.0.0 and 80 to listen from the outside.</p>
<p>Default: 127.0.0.1 and 8000
Configuration file equivalent: &#8211;host and &#8211;port</p>
</div>
<div class="section" id="id3">
<h3>USER and GROUP<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<p>The user and group the server will adopt after start up.</p>
<p>Useful when you run the command with admin rights to be able to listen to the
port 80, but you wish that the process do not have access to protected files.</p>
<p>GROUP is set to USER if not passed.</p>
<p>Default: None
Configuration file equivalent: &#8211;user and &#8211;group</p>
</div>
<div class="section" id="menu">
<h3>MENU<a class="headerlink" href="#menu" title="Permalink to this headline"></a></h3>
<p>A list of &#8216;name&#8217; + &#8216;link&#8217; pairs used to buld the menu at the top of each page.</p>
<p>You can use a relative or absolute link, and even an email address.</p>
<p>Any email address will be automatically protected against spam.</p>
<p>Default:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">MENU</span> <span class="o">=</span> <span class="p">(</span>
<span class="p">(</span><span class="s">&#39;Home&#39;</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">&#39;Download 0bin&#39;</span><span class="p">,</span> <span class="s">&#39;https://github.com/sametmax/0bin&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">&#39;Contact&#39;</span><span class="p">,</span> <span class="s">&#39;mailto:your@email.com&#39;</span><span class="p">)</span> <span class="c"># email</span>
<span class="p">)</span>
</pre></div>
</div>
<p>Command line equivalent: None</p>
</div>
<div class="section" id="max-size">
<h3>MAX_SIZE<a class="headerlink" href="#max-size" title="Permalink to this headline"></a></h3>
<p>Approximative value for a paste size limite.</p>
<p>Valeur approximative de limite de taille d&#8217;un paste.</p>
<p>Default = 500000 octets (500 ko)
Command line equivalent: None</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Options</a><ul>
<li><a class="reference internal" href="#command-line">Command line</a><ul>
<li><a class="reference internal" href="#host-and-port">&#8211;host and &#8211;port</a></li>
<li><a class="reference internal" href="#debug">&#8211;debug</a></li>
<li><a class="reference internal" href="#user-and-group">&#8211;user and &#8211;group</a></li>
<li><a class="reference internal" href="#settings-file">&#8211;settings-file</a></li>
<li><a class="reference internal" href="#compressed-static">&#8211;compressed-static</a></li>
<li><a class="reference internal" href="#version-and-help">&#8211;version and &#8211;help</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
<li><a class="reference internal" href="#configuration-file">Configuration file</a><ul>
<li><a class="reference internal" href="#id1">DEBUG</a></li>
<li><a class="reference internal" href="#static-files-root">STATIC_FILES_ROOT</a></li>
<li><a class="reference internal" href="#compressed-static-files">COMPRESSED_STATIC_FILES</a></li>
<li><a class="reference internal" href="#paste-files-root">PASTE_FILES_ROOT</a></li>
<li><a class="reference internal" href="#template-dirs">TEMPLATE_DIRS</a></li>
<li><a class="reference internal" href="#id2">HOST and PORT</a></li>
<li><a class="reference internal" href="#id3">USER and GROUP</a></li>
<li><a class="reference internal" href="#menu">MENU</a></li>
<li><a class="reference internal" href="#max-size">MAX_SIZE</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="theming.html"
title="previous chapter">Theming</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../fr/intro.html"
title="next chapter">Introduction</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/en/options.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../fr/intro.html" title="Introduction"
>next</a> |</li>
<li class="right" >
<a href="theming.html" title="Theming"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012, Sam et Max.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -0,0 +1,112 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installation in a virtualenv &mdash; 0bin 0.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Installing with Nginx" href="nginx_install.html" />
<link rel="prev" title="Installation with Apache" href="apache_install.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="nginx_install.html" title="Installing with Nginx"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="apache_install.html" title="Installation with Apache"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="installation-in-a-virtualenv">
<h1>Installation in a virtualenv<a class="headerlink" href="#installation-in-a-virtualenv" title="Permalink to this headline"></a></h1>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="apache_install.html"
title="previous chapter">Installation with Apache</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="nginx_install.html"
title="next chapter">Installing with Nginx</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/en/pip_install.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="nginx_install.html" title="Installing with Nginx"
>next</a> |</li>
<li class="right" >
<a href="apache_install.html" title="Installation with Apache"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012, Sam et Max.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -26,7 +26,7 @@
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Introduction" href="../fr/intro.html" />
<link rel="next" title="Options" href="options.html" />
<link rel="prev" title="Using supervisor" href="using_supervisor.html" />
</head>
<body>
@ -37,7 +37,7 @@
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../fr/intro.html" title="Introduction"
<a href="options.html" title="Options"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="using_supervisor.html" title="Using supervisor"
@ -53,6 +53,17 @@
<div class="section" id="theming">
<h1>Theming<a class="headerlink" href="#theming" title="Permalink to this headline"></a></h1>
<p>0bin comes a complete theming support, but for now it&#8217;s not well ingrated.</p>
<p>If you wish to create your own theme, you&#8217;ll need to create template similar
to the ones in zerobin/view, and add the path to the director containing them
to the settings file.</p>
<p>You&#8217;ll also need to copy static files from zerobin/static to a new direcotry
where you can edit them. And you need to add this directory in the
settings file too.</p>
<p>Of course, if you look for something simple, you can just edit all files in place/</p>
<p>But be careful, the javascript code is tightly coupled with HTML ID and classes,
and they are not very well organized for now.</p>
<p>If you have serious theming needs, please contact us so we improve the support.</p>
</div>
@ -65,8 +76,8 @@
<p class="topless"><a href="using_supervisor.html"
title="previous chapter">Using supervisor</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../fr/intro.html"
title="next chapter">Introduction</a></p>
<p class="topless"><a href="options.html"
title="next chapter">Options</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/en/theming.txt"
@ -96,7 +107,7 @@
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../fr/intro.html" title="Introduction"
<a href="options.html" title="Options"
>next</a> |</li>
<li class="right" >
<a href="using_supervisor.html" title="Using supervisor"

View File

@ -27,7 +27,7 @@
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Installation avec Nginx" href="nginx_install.html" />
<link rel="prev" title="&lt;no title&gt;" href="easy_install.html" />
<link rel="prev" title="Installation la plus simple" href="easy_install.html" />
</head>
<body>
<div class="related">
@ -40,7 +40,7 @@
<a href="nginx_install.html" title="Installation avec Nginx"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="easy_install.html" title="&lt;no title&gt;"
<a href="easy_install.html" title="Installation la plus simple"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
@ -53,6 +53,40 @@
<div class="section" id="installation-avec-apache">
<h1>Installation avec Apache<a class="headerlink" href="#installation-avec-apache" title="Permalink to this headline"></a></h1>
<p>Apache est plus lent, plus lourd, et plus complexe à mettre en oeuvre que Nginx.
Mais il est aussi beaucoup plus connu:</p>
<ul class="simple">
<li>plus de gens pourront vous aider les fora;</li>
<li>votre hébergeur propose surement Apache;</li>
<li>la syntaxe des fichiers de configuration est familière pour beaucoup.</li>
</ul>
<p>Une installation apache est aussi beaucoup plus solide et sécurisé qu&#8217;une
installation facile. Vous bénéficierez:</p>
<ul class="simple">
<li>de la possibilité d&#8217;avoir plusieurs projets écoutant sur le prot 80;</li>
<li>de plusieurs modules Apache à votre disposition (comme la limitation
du nombre de requêtes);</li>
<li>de la solidité d&#8217;Apache en front end: il est sécurité, et il y a peu de chance
qu&#8217;il crash sous une forte charge;</li>
<li>les processus de votre site ne tournent pas avec les droits admin, même si
&#8211;user ne fonctionne pas sur votre OS.</li>
</ul>
<p>Apache s&#8217;installe avec votre gestionnaire de paquet habituel, nous ne couvrierons
pas cette partie.</p>
<div class="section" id="mod-wsgi">
<h2>Mod_wsgi<a class="headerlink" href="#mod-wsgi" title="Permalink to this headline"></a></h2>
<p>Les serveurs Web Python modernes fonctionnent tous de la même manière, en suivant
une norme d&#8217;interfaçage: WSGI.</p>
<p>C&#8217;est la solution la plus performante, et celle recommandée. Mais elle demande
l&#8217;installation du modle Apache mod_wsgi. Si vous ne savez pas comment faire,
ou si vous ne pouvez pas le faire (par exemple sur un hébergement mutualisé
qui ne le propose pas), il vous faudra choisir l&#8217;installation CGI.</p>
</div>
<div class="section" id="mod-cgi">
<h2>Mod_CGI<a class="headerlink" href="#mod-cgi" title="Permalink to this headline"></a></h2>
<p>Cette installation est considérée comme relativement lente. Mais vous bénéficierez
tout de même de la robustesse d&#8217;Apache</p>
</div>
</div>
@ -61,9 +95,18 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Installation avec Apache</a><ul>
<li><a class="reference internal" href="#mod-wsgi">Mod_wsgi</a></li>
<li><a class="reference internal" href="#mod-cgi">Mod_CGI</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="easy_install.html"
title="previous chapter">&lt;no title&gt;</a></p>
title="previous chapter">Installation la plus simple</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="nginx_install.html"
title="next chapter">Installation avec Nginx</a></p>
@ -99,7 +142,7 @@
<a href="nginx_install.html" title="Installation avec Nginx"
>next</a> |</li>
<li class="right" >
<a href="easy_install.html" title="&lt;no title&gt;"
<a href="easy_install.html" title="Installation la plus simple"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>

View File

@ -53,6 +53,54 @@
<div class="section" id="installation-la-plus-simple">
<h1>Installation la plus simple<a class="headerlink" href="#installation-la-plus-simple" title="Permalink to this headline"></a></h1>
<p>Ces solutions sont simples et supportent le traffic d&#8217;un site web personnel.
Pour des solutions plus solides et sécurisées, essayez les installtion Apache
et Nginx.</p>
<div class="section" id="installation-en-10-secondes-si-vous-connaissez-python">
<h2>Installation en 10 secondes (si vous connaissez Python)<a class="headerlink" href="#installation-en-10-secondes-si-vous-connaissez-python" title="Permalink to this headline"></a></h2>
<p>pip install zerobin
zerobin &#8211;host 0.0.0.0 &#8211;port 80 &#8211;compressed-static # en tant qu&#8217;admin</p>
</div>
<div class="section" id="installation-en-30-secondes-pour-tous">
<h2>Installation en 30 secondes (pour tous)<a class="headerlink" href="#installation-en-30-secondes-pour-tous" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Assurez-vous d&#8217;avoir Python 2.6 ou 2.7 (<cite>python &#8211;version</cite>)</li>
<li>Télécharger le dernier zip du code source.</li>
<li>Décompressez tous les fichiers là où vous souhaitez mettre le site.</li>
<li>Allez dans les dossiers extraits.</li>
<li>Lancez <cite>python zerobin.py &#8211;host 0.0.0.0 &#8211;port 80 &#8211;compressed-static</cite>
avec les droits admin.</li>
</ul>
<p>Sous ubuntu, une line suffit:</p>
<div class="highlight-python"><pre>wget stuff &amp;&amp; unzip zerobin.zip &amp;&amp; cd zerobin &amp;&amp; sudo python zerobin.py --host 0.0.0.0 --port 80 --compressed-static</pre>
</div>
<p>Jetez un oeil aux options de configuration.</p>
</div>
<div class="section" id="faire-tourner-0bin-en-arriere-plan">
<h2>Faire tourner 0bin en arrière plan<a class="headerlink" href="#faire-tourner-0bin-en-arriere-plan" title="Permalink to this headline"></a></h2>
<p>0bin ne vient pas avec un moyen intégré pour le faire. Il y a plusieurs
solutions:</p>
<p>Pour un petit site:</p>
<p>Lancer simplement 0bin en processus shell d&#8217;arrière plan. Exemple sous GNU/Linux:</p>
<div class="highlight-python"><pre>nohup python zerobin.py --host 0.0.0.0 --port 80 --compressed-static &amp;</pre>
</div>
<p>Ou dans un screen.</p>
<p>Pour les gros sites Web:</p>
<ul class="simple">
<li>configurer 0bin et Apache;</li>
<li>configure 0bin avec supervisord (recommandé).</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Vous pouvez même utiliser zerobin sur votre réseau local depuis votre portable.</p>
<p>Assurez vous que votre parefeu ne bloque pas le port, et lancez:</p>
<div class="highlight-python"><pre>python zerobin.py --host 0.0.0.0 --port 8000</pre>
</div>
<p>0bin sera maintenant accessible sur <a class="reference external" href="http://your.local.ip.address:8000">http://your.local.ip.address:8000</a>.</p>
<p class="last">Ça peut être très un moyen très cool pour partager du code dans une entreprise
ou a un code sprint.</p>
</div>
</div>
</div>
@ -61,6 +109,16 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Installation la plus simple</a><ul>
<li><a class="reference internal" href="#installation-en-10-secondes-si-vous-connaissez-python">Installation en 10 secondes (si vous connaissez Python)</a></li>
<li><a class="reference internal" href="#installation-en-30-secondes-pour-tous">Installation en 30 secondes (pour tous)</a></li>
<li><a class="reference internal" href="#faire-tourner-0bin-en-arriere-plan">Faire tourner 0bin en arrière plan</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="intro.html"
title="previous chapter">Introduction</a></p>

View File

@ -27,7 +27,7 @@
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Installation la plus simple" href="easy_install.html" />
<link rel="prev" title="Theming" href="../en/theming.html" />
<link rel="prev" title="Options" href="../en/options.html" />
</head>
<body>
<div class="related">
@ -40,7 +40,7 @@
<a href="easy_install.html" title="Installation la plus simple"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../en/theming.html" title="Theming"
<a href="../en/options.html" title="Options"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
@ -57,7 +57,7 @@
quel type de contenu y soit posté. L&#8217;idée est qu&#8217;une personne ne peut (probablement...)
pas être tenue de <a class="reference external" href="http://linuxfr.org/news/zerobin-un-pastebin-securise">modérer le contenu du pastebin</a> si elle n&#8217;a aucun moyen
de le déchiffrer.</p>
<p>C&#8217;est une implémentation en Python du <cite>projet zerobin</cite>, facile à installer même
<p>C&#8217;est une implémentation en Python du <a class="reference external" href="https://github.com/sebsauvage/ZeroBin/">projet zerobin</a>, facile à installer même
si on ne connait pas ce langage.</p>
<div class="section" id="comment-ca-marche">
<h2>Comment ça marche<a class="headerlink" href="#comment-ca-marche" title="Permalink to this headline"></a></h2>
@ -105,26 +105,38 @@ plutôt qu&#8217;utiliser le copier/coller;</li>
<li><a class="reference external" href="http://bottlepy.org/">The Bottle Python Web microframework</a></li>
<li><a class="reference external" href="http://crypto.stanford.edu/sjcl/">SJCL</a> (js crypto tools)</li>
<li><a class="reference external" href="http://jquery.com/">jQuery</a></li>
<li><a class="reference external" href="http://twitter.github.com/bootstrap/">Bootstrap</a>, the twitter HTML5/CSS3 framework</li>
<li><a class="reference external" href="https://github.com/sametmax/VizHash.js">VizHash.js</a> to create visual hashes from pastes</li>
<li><a class="reference external" href="http://www.cherrypy.org/(serveronly)">Cherrypy</a> (server only)</li>
<li><a class="reference external" href="http://twitter.github.com/bootstrap/">Bootstrap</a>, le framework HTML5/CSS3 de Twitter</li>
<li><a class="reference external" href="https://github.com/sametmax/VizHash.js">VizHash.js</a> pour créer les hash visuels des pastes</li>
<li><a class="reference external" href="http://www.cherrypy.org/(serveronly)">Cherrypy</a> (serveur uniquement)</li>
</ul>
</div>
<div class="section" id="problemes-connus">
<h2>Problèmes connus<a class="headerlink" href="#problemes-connus" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>0bin use several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.</li>
<li>The &#8220;copy to clipboard&#8221; feature is buggy under linux. It&#8217;s flash, so we won&#8217;t fix it. Better wait for the HTML5 clipboard API to be implemented in major browsers.</li>
<li>The pasted content size limit check is not accurate. It&#8217;s just a safety net, so we thinks it&#8217;s ok.</li>
<li>Some url shorteners and other services storing URLs break the encryption key. We will sanitize the URL as much as we can, but there is a limit to what we can do.</li>
<li>0bin utilise plusieurs fonctionalités HTML5/CSS3 qui ne sont pas
encore largement supporté. Dans ce cas nous gérons la dégradation le plus
gracieusement possible.</li>
<li>La fonction &#8220;copier dans le press/papier&#8221; est buggée sous Linux. C&#8217;est du
flash donc nous ne le réparerons pas. Il vaut mieux attendre le support
du presse papier via l&#8217;API HTML5.</li>
<li>La vérification de la limite de ta taille du paste n&#8217;est pas précise. c&#8217;est
juste un filet de sécurité, donc nous pensons que ça suffira.</li>
<li>Quelques raccourcisseurs d&#8217;URL et d&#8217;autres services cassent la clé de
chiffrement. Nous essayerons de nettoyer autant que possible mais il y
a une limite à ce que nous pouvons faire.</li>
</ul>
</div>
<div class="section" id="what-does-0bin-not-implement">
<h2>What does 0bin not implement?<a class="headerlink" href="#what-does-0bin-not-implement" title="Permalink to this headline"></a></h2>
<div class="section" id="qu-est-ce-que-0bin-ne-fait-pas">
<h2>Qu&#8217;est-ce que 0bin ne fait pas ?<a class="headerlink" href="#qu-est-ce-que-0bin-ne-fait-pas" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Request throttling. It would be inefficient to do it at the app level, and web servers have robust implementations for it.</li>
<li>Hash collision: the ratio &#8220;probability it happens/consequence seriousness&#8221; &lt;a href=&#8221;<a class="reference external" href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions">http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions</a>&#8220;is not worth it&lt;/a</li>
<li>Comments: it was initially planed. But comes with a lot of issues so we chose to focus on lower handing fruits.</li>
<li>Limitation du nombre de requêtes: ce serait peu productif de le faire au
niveau de l&#8217;application alors que les serveurs Web le font tous de manière très
efficace.</li>
<li>La prévention de collision de hash: le ratio &#8220;occurence/conséquence&#8221;
n&#8217;est pas <a class="reference external" href="http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions">suffisant</a>.</li>
<li>Commentaires: c&#8217;était prévu. Mais il y a beaucoup de contraintes associées,
nous avons donc choisi de nous concentrer sur les fonctions avec un meilleur
rapport qualité/prix.</li>
</ul>
</div>
</div>
@ -142,14 +154,14 @@ plutôt qu&#8217;utiliser le copier/coller;</li>
<li><a class="reference internal" href="#autres-fonctionalites">Autres fonctionalités</a></li>
<li><a class="reference internal" href="#technologies-utilisees">Technologies utilisées</a></li>
<li><a class="reference internal" href="#problemes-connus">Problèmes connus</a></li>
<li><a class="reference internal" href="#what-does-0bin-not-implement">What does 0bin not implement?</a></li>
<li><a class="reference internal" href="#qu-est-ce-que-0bin-ne-fait-pas">Qu&#8217;est-ce que 0bin ne fait pas ?</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="../en/theming.html"
title="previous chapter">Theming</a></p>
<p class="topless"><a href="../en/options.html"
title="previous chapter">Options</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="easy_install.html"
title="next chapter">Installation la plus simple</a></p>
@ -185,7 +197,7 @@ plutôt qu&#8217;utiliser le copier/coller;</li>
<a href="easy_install.html" title="Installation la plus simple"
>next</a> |</li>
<li class="right" >
<a href="../en/theming.html" title="Theming"
<a href="../en/options.html" title="Options"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>

View File

@ -53,6 +53,54 @@
<div class="section" id="installation-avec-nginx">
<h1>Installation avec Nginx<a class="headerlink" href="#installation-avec-nginx" title="Permalink to this headline"></a></h1>
<p>Nginx est un choix très populaire pour servir un projet Python:</p>
<ul class="simple">
<li>Il est rapide.</li>
<li>Il est léger.</li>
<li>Les fichiers de configuration sont très simple.</li>
</ul>
<p>Si vous avez votre propre serveur, c&#8217;est le meilleur choix. Dans le cas contraire,
essayez l&#8217;installation la plus simple, ou avec Apache.</p>
<p>Nginx ne lance aucun processus Python, il sert uniquement les requêtes
depuis l&#8217;extérieur vers le server Python.</p>
<p>Il y a donc deux étapes:</p>
<ul class="simple">
<li>Faire tourner le processus Python.</li>
<li>Faire tourner Nginx.</li>
</ul>
<p>Ainsi, vous bénéficierez:</p>
<ul class="simple">
<li>de la possibilité d&#8217;avoir plusieurs projets écoutant sur le prot 80;</li>
<li>de plusieurs modules Nginx à votre disposition (comme la limitation
du nombre de requêtes);</li>
<li>de la solidité de Nginx en front end: il est sécurité, et il y a peu de chance
qu&#8217;il crash sous une forte charge;</li>
<li>les processus de votre site ne tournent pas avec les droits admin, même si
&#8211;user ne fonctionne pas sur votre OS;</li>
<li>de la capacité de gérer un processus Python sans toucher Nginx ou les autres
processus. C&#8217;est très pratique pour les mises à jour.</li>
</ul>
<div class="section" id="processus-python">
<h2>Processus Python<a class="headerlink" href="#processus-python" title="Permalink to this headline"></a></h2>
<p>Lancez 0bin comme d&#8217;habitude, mais cette fois pour écouter sur un host et un port
local. Ex</p>
<div class="highlight-python"><pre>zerobin --host 127.0.0.1 --port 8000</pre>
</div>
<p>En PHP, quand on édite un fichier, la modificiation est visible immédiatement.
En Python, l&#8217;intégralité du code est chargé en mémoire pour des raisons de
performance. Pour cette raison, il faut redémarrer le processus Python pour voir
les changement prendre effet. Avoir un processus séparé permet de le faire
sans avoir à redémarer le serveur.</p>
</div>
<div class="section" id="nginx">
<h2>Nginx<a class="headerlink" href="#nginx" title="Permalink to this headline"></a></h2>
<p>Nginx peut être installé avec votre gestionnaire de paquets habituels, donc
nous ne couvrirons pas cette partie.</p>
<p>Vous devez créer une fichier de configuration Nginx pour 0bin. Sous GNU/Linux,
on les mets en général dans /etc/nginx/conf.d/. Nommez le zerobin.conf.</p>
<p>Le fichier minimal pour faire tourner le site est:</p>
<p>Mais on peut apporter plusieurs améliorations de performance:</p>
</div>
</div>
@ -61,6 +109,15 @@
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Installation avec Nginx</a><ul>
<li><a class="reference internal" href="#processus-python">Processus Python</a></li>
<li><a class="reference internal" href="#nginx">Nginx</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="apache_install.html"
title="previous chapter">Installation avec Apache</a></p>

View File

@ -0,0 +1,291 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Options &mdash; 0bin 0.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="prev" title="Personnaliser lapparence" href="theming.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="theming.html" title="Personnaliser lapparence"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="options">
<h1>Options<a class="headerlink" href="#options" title="Permalink to this headline"></a></h1>
<p>Le comportement de 0bin peut être ajusté à l&#8217;aide d&#8217;options passées depuis un
fichier de configuration ou directement à la ligne de commande. Certains
paramètres sont uniquement disponibles dans le fichier de configuration.</p>
<p>Si une option n&#8217;est pas passée, 0bin utilise la valeur par
défaut présente dans le fichier zerobin/default_settings.py.</p>
<div class="section" id="ligne-de-commande">
<h2>Ligne de commande<a class="headerlink" href="#ligne-de-commande" title="Permalink to this headline"></a></h2>
<div class="section" id="host-et-port">
<h3>&#8211;host et &#8211;port<a class="headerlink" href="#host-et-port" title="Permalink to this headline"></a></h3>
<p>L&#8217;hôte et le port sur lesquels écouter les requêtes entrantes. En général
127.0.0.1 et 8000 pour écouter localement, ou 0.0.0.0 et 80 pour
écouter les requêtes extérieures.</p>
<p>Défaut: 127.0.0.1 et 8000
Equivalent du fichier de configuration : HOST et PORT</p>
</div>
<div class="section" id="debug">
<h3>&#8211;debug<a class="headerlink" href="#debug" title="Permalink to this headline"></a></h3>
<p>Afffiche un listing d&#8217;informations utiles pour déboguer quand quelque chose
se passe mal à la place d&#8217;une page d&#8217;erreur 500.</p>
<p>En mode debug, le serveur recharge aussi automatiquement tout fichier Python
modifié.</p>
<p>Défaut: False
Equivalent du fichier de configuration : DEBUG</p>
</div>
<div class="section" id="user-et-group">
<h3>&#8211;user et &#8211;group<a class="headerlink" href="#user-et-group" title="Permalink to this headline"></a></h3>
<p>L&#8217;utilisateur et le group que le serveur essayera d&#8217;adopter après le démarrage.</p>
<p>Utile quand on lance la commande avec les droits admin afin de pouvoir
écouter sur le port 80, mais qu&#8217;on souhaite, pour des raisons de sécurité, que
le processus n&#8217;est pas accès aux fichiers protégés du système.</p>
<p>&#8211;group prend de &#8211;user si il n&#8217;est pas précisé.</p>
<p>Défaut: Aucun
Equivalent du fichier de configuration : USER et GROUP</p>
</div>
<div class="section" id="settings-file">
<h3>&#8211;settings-file<a class="headerlink" href="#settings-file" title="Permalink to this headline"></a></h3>
<p>Chemin vers le fichier de configuration, si vous souhaitez en utiliser un.</p>
<p>Défaut: Aucun
Equivalent du fichier de configuration : Aucun</p>
</div>
<div class="section" id="compressed-static">
<h3>&#8211;compressed-static<a class="headerlink" href="#compressed-static" title="Permalink to this headline"></a></h3>
<p>Sert les versions minifiées fichiers statiques (css et js). A utiliser en
production pour un site plus rapide.</p>
<p>Défaut: False
Equivalent du fichier de configuration : COMPRESSED_STATIC_FILES</p>
</div>
<div class="section" id="version-et-help">
<h3>&#8211;version et &#8211;help<a class="headerlink" href="#version-et-help" title="Permalink to this headline"></a></h3>
<p>Affiche l&#8217;aide ou la version de 0bin</p>
<p>Défaut: Aucun
Equivalent du fichier de configuration : Aucun</p>
</div>
<div class="section" id="exemples">
<h3>Exemples<a class="headerlink" href="#exemples" title="Permalink to this headline"></a></h3>
<p>Production:</p>
<div class="highlight-python"><pre>sudo zerobin --host 0.0.0.0 --port 80 --user foo --compressed-static</pre>
</div>
<p>Développement:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">zerobin</span> <span class="o">--</span><span class="n">debug</span> <span class="o">--</span><span class="n">serve</span><span class="o">-</span><span class="n">static</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="fichier-de-configuration">
<h2>Fichier de configuration<a class="headerlink" href="#fichier-de-configuration" title="Permalink to this headline"></a></h2>
<p>Le fichier configuration doit être un fichier Python ordinnaire, généralement
appelé settings.py. On l&#8217;utilise ainsi:</p>
<div class="highlight-python"><pre>zerobin --settings-file '/chemin/vers/settings.py'</pre>
</div>
<p>Toutes les autres options passées à la commandes auront priorité sur les options
du fichier de configuration. Le fichier zerobin/default_settings.py peut servir
d&#8217;exemple pour créer son propre fichier de configuration, il est largement commenté.</p>
<div class="section" id="id1">
<h3>DEBUG<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<p>Afffiche un listing d&#8217;informations utiles pour déboguer quand quelque chose
se passe mal à la place d&#8217;une page d&#8217;erreur 500.</p>
<p>En mode debug, le serveur recharge aussi automatiquement tout fichier Python
modifié.</p>
<p>Défaut: False
Equivalent en ligne de commande : &#8211;debug</p>
</div>
<div class="section" id="static-files-root">
<h3>STATIC_FILES_ROOT<a class="headerlink" href="#static-files-root" title="Permalink to this headline"></a></h3>
<p>Chemin absolu du dossier dans lequel 0bin va chercher les fichiers statiques
(css, js et images).</p>
<p>Défaut: dossier &#8220;static&#8221; dans le dossier &#8220;zerobin&#8221;
Equivalent en ligne de commande : Aucun</p>
</div>
<div class="section" id="compressed-static-files">
<h3>COMPRESSED_STATIC_FILES<a class="headerlink" href="#compressed-static-files" title="Permalink to this headline"></a></h3>
<p>Sert les versions minifiées fichiers statiques (css et js). A utiliser en
production pour un site plus rapide.</p>
<p>Défaut: False
Equivalent en ligne de commande : &#8211;compressed-static</p>
</div>
<div class="section" id="paste-files-root">
<h3>PASTE_FILES_ROOT<a class="headerlink" href="#paste-files-root" title="Permalink to this headline"></a></h3>
<p>Chemin absolu du dossier dans lequel 0bin va sauvegarder les pastes.</p>
<p>Défaut: dossier &#8220;static/content&#8221; dans le dossier &#8220;zerobin&#8221;
Equivalent en ligne de commande : Aucun</p>
</div>
<div class="section" id="template-dirs">
<h3>TEMPLATE_DIRS<a class="headerlink" href="#template-dirs" title="Permalink to this headline"></a></h3>
<p>Liste des chemins absolus des dossiers qui contiennent les templates que 0bin
utilise pour générer les pages du site. Les premiers éléments de la liste
ont priorités sur les suivant.</p>
<p>Si vous voulez utiliser vos propres templates, ajoutez le dossier qui les
contient au début de la liste:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">zerobin.defauls_settings</span> <span class="kn">import</span> <span class="n">TEMPLATE_DIRS</span>
<span class="n">TEMPLATE_DIRS</span> <span class="o">=</span> <span class="p">(</span>
<span class="s">&#39;/chemin/version/votre/dossier/de/templates&#39;</span><span class="p">,</span>
<span class="p">)</span> <span class="o">+</span> <span class="n">TEMPLATE_DIRS</span>
</pre></div>
</div>
<p>Défaut: dossier &#8220;view&#8221; dans le dossier &#8220;zerobin&#8221;
Equivalent en ligne de commande : Aucun</p>
</div>
<div class="section" id="id2">
<h3>HOST et PORT<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<p>L&#8217;hôte et le port sur lesquels écouter les requêtes entrantes. En général
127.0.0.1 et 8000 pour écouter localement, ou 0.0.0.0 et 80 pour
écouter les requêtes extérieures.</p>
<p>Défaut: 127.0.0.1 et 8000
Equivalent du fichier de configuration : &#8211;host et &#8211;port</p>
</div>
<div class="section" id="id3">
<h3>USER et GROUP<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<p>L&#8217;utilisateur et le group que le serveur essayera d&#8217;adopter après le démarrage.</p>
<p>Utile quand on lance la commande avec les droits admin afin de pouvoir
écouter sur le port 80, mais qu&#8217;on souhaite, pour des raisons de sécurité, que
le processus n&#8217;est pas accès au fichiers système.</p>
<p>GROUP prend de USER si il n&#8217;est pas précisé.</p>
<p>Défaut: Aucun
Equivalent du fichier de configuration : &#8211;user et &#8211;group</p>
</div>
<div class="section" id="menu">
<h3>MENU<a class="headerlink" href="#menu" title="Permalink to this headline"></a></h3>
<p>Une liste de paires &#8216;Nom&#8217; + &#8216;Liens&#8217; à utiliser pour construire le menu qui
est en haut de chaque page.</p>
<p>Le lien peut être un lien relatif, absolu, ou une adresse email.</p>
<p>Toute addresse email sera automatiquement protégée contre le spam.</p>
<p>Défaut:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">MENU</span> <span class="o">=</span> <span class="p">(</span>
<span class="p">(</span><span class="s">&#39;Home&#39;</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">&#39;Download 0bin&#39;</span><span class="p">,</span> <span class="s">&#39;https://github.com/sametmax/0bin&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">&#39;Contact&#39;</span><span class="p">,</span> <span class="s">&#39;mailto:your@email.com&#39;</span><span class="p">)</span> <span class="c"># email</span>
<span class="p">)</span>
</pre></div>
</div>
<p>Equivalent en ligne de commande : Aucun</p>
</div>
<div class="section" id="max-size">
<h3>MAX_SIZE<a class="headerlink" href="#max-size" title="Permalink to this headline"></a></h3>
<p>Valeur approximative de limite de taille d&#8217;un paste.</p>
<p>Défaut = 500000 octets (500 ko)
Equivalent en ligne de commande : Aucun</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Options</a><ul>
<li><a class="reference internal" href="#ligne-de-commande">Ligne de commande</a><ul>
<li><a class="reference internal" href="#host-et-port">&#8211;host et &#8211;port</a></li>
<li><a class="reference internal" href="#debug">&#8211;debug</a></li>
<li><a class="reference internal" href="#user-et-group">&#8211;user et &#8211;group</a></li>
<li><a class="reference internal" href="#settings-file">&#8211;settings-file</a></li>
<li><a class="reference internal" href="#compressed-static">&#8211;compressed-static</a></li>
<li><a class="reference internal" href="#version-et-help">&#8211;version et &#8211;help</a></li>
<li><a class="reference internal" href="#exemples">Exemples</a></li>
</ul>
</li>
<li><a class="reference internal" href="#fichier-de-configuration">Fichier de configuration</a><ul>
<li><a class="reference internal" href="#id1">DEBUG</a></li>
<li><a class="reference internal" href="#static-files-root">STATIC_FILES_ROOT</a></li>
<li><a class="reference internal" href="#compressed-static-files">COMPRESSED_STATIC_FILES</a></li>
<li><a class="reference internal" href="#paste-files-root">PASTE_FILES_ROOT</a></li>
<li><a class="reference internal" href="#template-dirs">TEMPLATE_DIRS</a></li>
<li><a class="reference internal" href="#id2">HOST et PORT</a></li>
<li><a class="reference internal" href="#id3">USER et GROUP</a></li>
<li><a class="reference internal" href="#menu">MENU</a></li>
<li><a class="reference internal" href="#max-size">MAX_SIZE</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="theming.html"
title="previous chapter">Personnaliser l&#8217;apparence</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/fr/options.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="theming.html" title="Personnaliser lapparence"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012, Sam et Max.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -0,0 +1,112 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installation dans un virtualenv &mdash; 0bin 0.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Installation avec Nginx" href="nginx_install.html" />
<link rel="prev" title="Installation avec Apache" href="apache_install.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="nginx_install.html" title="Installation avec Nginx"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="apache_install.html" title="Installation avec Apache"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="installation-dans-un-virtualenv">
<h1>Installation dans un virtualenv<a class="headerlink" href="#installation-dans-un-virtualenv" title="Permalink to this headline"></a></h1>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="apache_install.html"
title="previous chapter">Installation avec Apache</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="nginx_install.html"
title="next chapter">Installation avec Nginx</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/fr/pip_install.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="nginx_install.html" title="Installation avec Nginx"
>next</a> |</li>
<li class="right" >
<a href="apache_install.html" title="Installation avec Apache"
>previous</a> |</li>
<li><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012, Sam et Max.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -26,6 +26,7 @@
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Options" href="options.html" />
<link rel="prev" title="Utiliser supervisor" href="using_supervisor.html" />
</head>
<body>
@ -35,6 +36,9 @@
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="options.html" title="Options"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="using_supervisor.html" title="Utiliser supervisor"
accesskey="P">previous</a> |</li>
@ -49,6 +53,19 @@
<div class="section" id="personnaliser-l-apparence">
<h1>Personnaliser l&#8217;apparence<a class="headerlink" href="#personnaliser-l-apparence" title="Permalink to this headline"></a></h1>
<p>0bin possède un support de theming complet, mais pour le moment mal intégré.</p>
<p>Si vous souhaitez créer votre propre theme, il vous faut créer des templates
similaires à ceux par défault présents dans zerobin/view, et
ajouter le chemin du dossier contenant ces templates au fichier de settings.</p>
<p>Vous aurez également besoin de copier les fichiers statiques présent
dans zerobin/static dans un nouveau dossier, puis les modifier. Et signifier
que vous utilisez ce dossier dans le fichiers de settings.</p>
<p>Vous pouvez bien entendu également éditez tous les fichier directement par
souci de simplicité.</p>
<p>Attention cependant, le code javascript est très dépendant des ID et classes
du HTML, qui ne sont pour le moment pas très bien organisés.</p>
<p>Si vous avez de sérieux besoin de theming, contactez-nous, afin que nous
améliorons le support.</p>
</div>
@ -60,6 +77,9 @@
<h4>Previous topic</h4>
<p class="topless"><a href="using_supervisor.html"
title="previous chapter">Utiliser supervisor</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="options.html"
title="next chapter">Options</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/fr/theming.txt"
@ -88,6 +108,9 @@
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="options.html" title="Options"
>next</a> |</li>
<li class="right" >
<a href="using_supervisor.html" title="Utiliser supervisor"
>previous</a> |</li>

View File

@ -53,27 +53,28 @@
<ul class="simple">
<li>Try it: <a class="reference external" href="http://0bin.net">0bin.net</a></li>
<li>Get the <a class="reference external" href="https://github.com/sametmax/0bin">source on github</a></li>
<li><a class="reference external" href="https://github.com/sametmax/0bin/issues">Report a bug</a></li>
</ul>
<table border="1" class="docutils">
<colgroup>
<col width="47%" />
<col width="53%" />
<col width="44%" />
<col width="56%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>English</td>
<td>Français</td>
</tr>
<tr class="row-even"><td><div class="toctree-wrapper first last compound">
<tr class="row-even"><td><div class="toctree-wrapper first compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="en/intro.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/easy_install.html">Easiest installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/apache_install.html">Installation with Apache</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/nginx_install.html">Installing with Nginx</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/apache_install.html">Apache setup</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/nginx_install.html">Nginx setup</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/using_supervisor.html">Using supervisor</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/theming.html">Theming</a></li>
<li class="toctree-l1"><a class="reference internal" href="en/options.html">Options</a></li>
</ul>
</div>
<p class="last"><a class="reference external" href="&lt;https://github.com/sametmax/0bin/issues&gt;">Report a bug</a></p>
</td>
<td><div class="toctree-wrapper first compound">
<ul>
@ -83,6 +84,7 @@
<li class="toctree-l1"><a class="reference internal" href="fr/nginx_install.html">Installation avec Nginx</a></li>
<li class="toctree-l1"><a class="reference internal" href="fr/using_supervisor.html">Utiliser supervisor</a></li>
<li class="toctree-l1"><a class="reference internal" href="fr/theming.html">Personnaliser l&#8217;apparence</a></li>
<li class="toctree-l1"><a class="reference internal" href="fr/options.html">Options</a></li>
</ul>
</div>
<p class="last"><a class="reference external" href="https://github.com/sametmax/0bin/issues">Signaler un bug</a></p>

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,39 @@
=========================
Installation with Apache
=========================
=============
Apache setup
=============
Apache is slower, heavier and more complicated to setup than Nginx. But it's also
much more famous:
- more people will be able to help you on forums;
- your hosting will most probably support Apache;
- the configuration file syntax is familiar to a lot of people.
An Apache setup is still much more robust and secure than an easy installation.
Une installation apache est aussi beaucoup plus solide et sécurisé qu'une
installation facile. You'll benefit from having:
- the possiblity to have several projects listening to the port 80;
- several Apache module at your disposal (like requests throttling);
- Apache robustness in front end: it's secure, and there is much less chance
it will crash under heavy load;
- your web site processes won't run with admin rights, even if --user doesn't
work on your OS.
Mod_wsgi
==========
The modern Web Python servers all work the same way, following an norm for
interfacing: WSGI.
This is the most performante solution, and the best to use. But it will require
the setup of the Apache module mod_wsgi. If you don't know how to do this, or
if you can't do it (E.G: your hosting won't let you), you need to go for
the CGI setup.
==========
This setup is considered as slow, but you will still benefit from Apache
robustness.

View File

@ -1,3 +1,58 @@
====================
Easiest installation
====================
====================
These solution are easy all will be able to handle a personnal website traffic.
For more robust and secure solutions, see Apache et Nginx setups.
10 seconds setup (if you know Python already)
===============================================
pip install zerobin
zerobin --host 0.0.0.0 --port 80 --compressed-static # as admin
30 seconds setup (for anybody)
===============================
- Make sure you have Python 2.6 or 2.7 (`python --version`)
- Download the last zip of the sources code.
- Extract all of it where you wish the site to be stored.
- Go to the extracted files.
- Run `python zerobin.py --host 0.0.0.0 --port 80 --compressed-static`
with the admin rights.
On ubuntu, this is a one liner::
wget stuff && unzip zerobin.zip && cd zerobin && sudo python zerobin.py --host 0.0.0.0 --port 80 --compressed-static
Check out for more configuration options.
Run 0bin in background
=======================
0bin doesn't come with something built in for this. You have several solutions:
For a small website:
Just make it a shell background process. E.G in GNU/Linux::
nohup python zerobin.py --host 0.0.0.0 --port 80 --compressed-static &
Or run it in a screen.
For a big Website:
- setup 0bin with Apache;
- setup 0bin with supervisord (best way to do it);
.. Note::
You can even use zerobin on your private local network from your laptop.
Make sure you firewall won't block the port, and run::
python zerobin.py --host 0.0.0.0 --port 8000
0bin will now be accessible from http://your.local.ip.address:8000.
This can be very cool way to share code in a companie or during a code sprint.

View File

@ -62,7 +62,7 @@ Technologies used
Known issues
============
- 0bin use several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.
- 0bin uses several HTML5/CSS3 features that are not widely supported. In that case we handle the degradation as gracefully as we can.
- The "copy to clipboard" feature is buggy under linux. It's flash, so we won't fix it. Better wait for the HTML5 clipboard API to be implemented in major browsers.
- The pasted content size limit check is not accurate. It's just a safety net, so we thinks it's ok.
- Some url shorteners and other services storing URLs break the encryption key. We will sanitize the URL as much as we can, but there is a limit to what we can do.

View File

@ -1,3 +1,64 @@
========================
Installing with Nginx
========================
============
Nginx setup
============
Nginx is a very popular choice to serve a Python project:
- It's fast.
- It's lightweight.
- Configuration files are simple.
If you have your own server, it's the best choice. If not, try the easiest
setup, or the Apache setup.
Nginx doesn't run any Python process, it only serve requests from outside to
the Python server.
Therefor there are two steps:
- Run the Python process.
- Run Nginx.
You will benefit from having:
- the possiblity to have several projects listening to the port 80;
- several Apache module at your disposal (like requests throttling);
- Apache robustness in front end: it's secure, and there is much less chance
it will crash under heavy load;
- your web site processes won't run with admin rights, even if --user doesn't
work on your OS;
- the ability to manage a Python process without touching Nginx or the other
processes. It's very handy for updates.
The Python process
==================
Run 0bin as usual, but this time make it listen to a local port and host. E.G::
zerobin --host 127.0.0.1 --port 8000
In PHP, when you edit a file, the changes are immediatly visible. In Python,
the whole code is often loaded in memory for performance reasons. This means
you have to restart the Python process to see the changes effect. Having a
separate process let you do this without having to restart the server.
Nginx
======
Nginx can be installed with you usual package manager, so we won't cover
installing it.
Vous must create a Nginx configuration file for 0bin. On GNU/Linux, they usually
go into /etc/nginx/conf.d/. Name it zerobin.conf.
The minimal file to run the site is:
But you can make some adjustement to get better perfomances:

218
docs/en/options.rst Normal file
View File

@ -0,0 +1,218 @@
--host=STR
The host on which to listen for incomming request. Usually 127.0.0.1 to
listen locally or 0.0.0.0 to listen from the outside.
Default: 127.0.0.1
Setting file : HOST
============
Options
============
0bin's behavior can be adjusted with options passed using a configuration
file or directly using the command line. Some parameters are only available
in the configuration file.
If an option is not passed, 0bin will use the default value from the file
zerobin/default_settings.py.
Command line
==================
--host and --port
-------------------
The host and port on which to listen for incomming request. Usually 127.0.0.1
and 8000 to listen locally or 0.0.0.0 and 80 to listen from the outside.
Default: 127.0.0.1 and 8000
Setting file : HOST and PORT
--debug
----------
Display a listing of useful debugging information when something goes wrong
instead of showing the 500 error page.
In debug mode, the server also reload automatically any modified Python file;
Default: False
Configuration file equivalent: DEBUG
--user and --group
-------------------
The user and group the server will adopt after start up.
Useful when you run the command with admin rights to be able to listen to the
port 80, but you wish that the process do not have access to protected files.
--group is set to --user if not passed.
Default: None
Configuration file equivalent: USER and GROUP
--settings-file
-----------------
Path to the configuration file, if you use any.
Default: None
Configuration file equivalent: None
--compressed-static
--------------------
Serve minified static files (css and js). Use it in production to get a faster
web site.
Default: False
Configuration file equivalent: COMPRESSED_STATIC_FILES
--version and --help
--------------------
Display the help or the version of 0bin.
Default: None
Configuration file equivalent: None
Examples
----------
Production::
sudo zerobin --host 0.0.0.0 --port 80 --user foo --compressed-static
Developpement::
zerobin --debug --serve-static
Configuration file
====================
The configuration file should be an ordinary Python file, usually named
settings.py. It's used this way::
zerobin --settings-file '/path/to/settings.py'
Any options passed to the command line will have priority on the ones in
the configuration file. The zerobin/default_settings.py can be used as an
example to create your own file. It's heavily commented.
DEBUG
-----
Display a listing of useful debugging information when something goes wrong
instead of showing the 500 error page.
In debug mode, the server also reload automatically any modified Python file;
Default: False
Command line equivalent: --debug
STATIC_FILES_ROOT
------------------
Asbolute path to the directory where 0bin is going to look for static files
(css, js and images).
Default: "static" directory in the "zerobin" directory
Command line equivalent: None
COMPRESSED_STATIC_FILES
-------------------------
Serve minified static files (css and js). Use it in production to get a faster
web site.
Default: False
Command line equivalent: --compressed-static
PASTE_FILES_ROOT
-----------------
Absolute path to the directory in which 0bin is going to look save pastes.
Default: "static/content" direcotry in the "zerobin" directory
Command line equivalent: None
TEMPLATE_DIRS
--------------
List of absolute path to directories containing templates that 0bin uses to
generate the web site pages. The first list items have priotity on the later.
If you wish to use your own templates, add the directory containing them
at the begining of the list::
from zerobin.defauls_settings import TEMPLATE_DIRS
TEMPLATE_DIRS = (
'/directy/path/to/your/templates',
) + TEMPLATE_DIRS
Default: "view" directory in the "zerobin" directory
Command line equivalent: None
HOST and PORT
-------------------
The host and port on which to listen for incomming request. Usually 127.0.0.1
and 8000 to listen locally or 0.0.0.0 and 80 to listen from the outside.
Default: 127.0.0.1 and 8000
Configuration file equivalent: --host and --port
USER and GROUP
-------------------
The user and group the server will adopt after start up.
Useful when you run the command with admin rights to be able to listen to the
port 80, but you wish that the process do not have access to protected files.
GROUP is set to USER if not passed.
Default: None
Configuration file equivalent: --user and --group
MENU
------
A list of 'name' + 'link' pairs used to buld the menu at the top of each page.
You can use a relative or absolute link, and even an email address.
Any email address will be automatically protected against spam.
Default::
MENU = (
('Home', '/'),
('Download 0bin', 'https://github.com/sametmax/0bin'),
('Contact', 'mailto:your@email.com') # email
)
Command line equivalent: None
MAX_SIZE
---------
Approximative value for a paste size limite.
Valeur approximative de limite de taille d'un paste.
Default = 500000 octets (500 ko)
Command line equivalent: None

View File

@ -1,3 +1,22 @@
=======
Theming
=======
=======
0bin comes a complete theming support, but for now it's not well ingrated.
If you wish to create your own theme, you'll need to create template similar
to the ones in zerobin/view, and add the path to the director containing them
to the settings file.
You'll also need to copy static files from zerobin/static to a new direcotry
where you can edit them. And you need to add this directory in the
settings file too.
Of course, if you look for something simple, you can just edit all files in place/
But be careful, the javascript code is tightly coupled with HTML ID and classes,
and they are not very well organized for now.
If you have serious theming needs, please contact us so we improve the support.

View File

@ -1,3 +1,42 @@
=========================
Installation avec Apache
=========================
=========================
Apache est plus lent, plus lourd, et plus complexe à mettre en oeuvre que Nginx.
Mais il est aussi beaucoup plus connu:
- plus de gens pourront vous aider les fora;
- votre hébergeur propose surement Apache;
- la syntaxe des fichiers de configuration est familière pour beaucoup.
Une installation apache est aussi beaucoup plus solide et sécurisé qu'une
installation facile. Vous bénéficierez:
- de la possibilité d'avoir plusieurs projets écoutant sur le prot 80;
- de plusieurs modules Apache à votre disposition (comme la limitation
du nombre de requêtes);
- de la solidité d'Apache en front end: il est sécurité, et il y a peu de chance
qu'il crash sous une forte charge;
- les processus de votre site ne tournent pas avec les droits admin, même si
--user ne fonctionne pas sur votre OS.
Apache s'installe avec votre gestionnaire de paquet habituel, nous ne couvrierons
pas cette partie.
Mod_wsgi
==========
Les serveurs Web Python modernes fonctionnent tous de la même manière, en suivant
une norme d'interfaçage: WSGI.
C'est la solution la plus performante, et celle recommandée. Mais elle demande
l'installation du modle Apache mod_wsgi. Si vous ne savez pas comment faire,
ou si vous ne pouvez pas le faire (par exemple sur un hébergement mutualisé
qui ne le propose pas), il vous faudra choisir l'installation CGI.
Mod_CGI
==========
Cette installation est considérée comme relativement lente. Mais vous bénéficierez
tout de même de la robustesse d'Apache

View File

@ -1,3 +1,62 @@
===========================
============================
Installation la plus simple
===========================
============================
Ces solutions sont simples et supportent le traffic d'un site web personnel.
Pour des solutions plus solides et sécurisées, essayez les installtion Apache
et Nginx.
Installation en 10 secondes (si vous connaissez Python)
========================================================
pip install zerobin
zerobin --host 0.0.0.0 --port 80 --compressed-static # en tant qu'admin
Installation en 30 secondes (pour tous)
=======================================
- Assurez-vous d'avoir Python 2.6 ou 2.7 (`python --version`)
- Télécharger le dernier zip du code source.
- Décompressez tous les fichiers là où vous souhaitez mettre le site.
- Allez dans les dossiers extraits.
- Lancez `python zerobin.py --host 0.0.0.0 --port 80 --compressed-static`
avec les droits admin.
Sous ubuntu, une line suffit::
wget stuff && unzip zerobin.zip && cd zerobin && sudo python zerobin.py --host 0.0.0.0 --port 80 --compressed-static
Jetez un oeil aux options de configuration.
Faire tourner 0bin en arrière plan
==================================
0bin ne vient pas avec un moyen intégré pour le faire. Il y a plusieurs
solutions:
Pour un petit site:
Lancer simplement 0bin en processus shell d'arrière plan. Exemple sous GNU/Linux::
nohup python zerobin.py --host 0.0.0.0 --port 80 --compressed-static &
Ou dans un screen.
Pour les gros sites Web:
- configurer 0bin et Apache;
- configure 0bin avec supervisord (recommandé).
.. Note::
Vous pouvez même utiliser zerobin sur votre réseau local depuis votre portable.
Assurez vous que votre parefeu ne bloque pas le port, et lancez::
python zerobin.py --host 0.0.0.0 --port 8000
0bin sera maintenant accessible sur http://your.local.ip.address:8000.
Ça peut être très un moyen très cool pour partager du code dans une entreprise
ou a un code sprint.

View File

@ -7,7 +7,7 @@ quel type de contenu y soit posté. L'idée est qu'une personne ne peut (probabl
pas être tenue de `modérer le contenu du pastebin`_ si elle n'a aucun moyen
de le déchiffrer.
C'est une implémentation en Python du `projet zerobin`, facile à installer même
C'est une implémentation en Python du `projet zerobin`_, facile à installer même
si on ne connait pas ce langage.
Comment ça marche
@ -65,28 +65,28 @@ Problèmes connus
=================
- 0bin utilise plusieurs fonctionalités HTML5/CSS3 qui ne sont pas
encore largement supporté. Dans ce cas nous gérons la dégradation le plus
gracieusement possible.
encore largement supporté. Dans ce cas nous gérons la dégradation le plus
gracieusement possible.
- La fonction "copier dans le press/papier" est buggée sous Linux. C'est du
flash donc nous ne le réparerons pas. Il vaut mieux attendre le support
du presse papier via l'API HTML5.
flash donc nous ne le réparerons pas. Il vaut mieux attendre le support
du presse papier via l'API HTML5.
- La vérification de la limite de ta taille du paste n'est pas précise. c'est
juste un filet de sécurité, donc nous pensons que ça suffira.
juste un filet de sécurité, donc nous pensons que ça suffira.
- Quelques raccourcisseurs d'URL et d'autres services cassent la clé de
chiffrement. Nous essayerons de nettoyer autant que possible mais il y
a une limite à ce que nous pouvons faire.
chiffrement. Nous essayerons de nettoyer autant que possible mais il y
a une limite à ce que nous pouvons faire.
Qu'est-ce que 0bin ne fait pas ?
=================================
* Limitation du nombre de requête: ce serait peu productif de le faire au
niveau de l'application alors que les serveurs Web le font tous de manière plus
efficace.
* La prévention d'une collision de hash: le ratio "occurence/conséquence"
n'est pas suffisant_.
* Commentaires: c'était prévu. Mais il y a beaucoup de contraintes associées,
nous avons donc choisi de nous concentrer sur les fonctions avec un meilleur
rapport qualité/prix.
- Limitation du nombre de requêtes: ce serait peu productif de le faire au
niveau de l'application alors que les serveurs Web le font tous de manière très
efficace.
- La prévention de collision de hash: le ratio "occurence/conséquence"
n'est pas suffisant_.
- Commentaires: c'était prévu. Mais il y a beaucoup de contraintes associées,
nous avons donc choisi de nous concentrer sur les fonctions avec un meilleur
rapport qualité/prix.
.. _modérer le contenu du pastebin: http://linuxfr.org/news/zerobin-un-pastebin-securise

View File

@ -1,3 +1,67 @@
========================
Installation avec Nginx
========================
========================
Nginx est un choix très populaire pour servir un projet Python:
- Il est rapide.
- Il est léger.
- Les fichiers de configuration sont très simple.
Si vous avez votre propre serveur, c'est le meilleur choix. Dans le cas contraire,
essayez l'installation la plus simple, ou avec Apache.
Nginx ne lance aucun processus Python, il sert uniquement les requêtes
depuis l'extérieur vers le server Python.
Il y a donc deux étapes:
- Faire tourner le processus Python.
- Faire tourner Nginx.
Ainsi, vous bénéficierez:
- de la possibilité d'avoir plusieurs projets écoutant sur le prot 80;
- de plusieurs modules Nginx à votre disposition (comme la limitation
du nombre de requêtes);
- de la solidité de Nginx en front end: il est sécurité, et il y a peu de chance
qu'il crash sous une forte charge;
- les processus de votre site ne tournent pas avec les droits admin, même si
--user ne fonctionne pas sur votre OS;
- de la capacité de gérer un processus Python sans toucher Nginx ou les autres
processus. C'est très pratique pour les mises à jour.
Processus Python
==================
Lancez 0bin comme d'habitude, mais cette fois pour écouter sur un host et un port
local. Ex ::
zerobin --host 127.0.0.1 --port 8000
En PHP, quand on édite un fichier, la modificiation est visible immédiatement.
En Python, l'intégralité du code est chargé en mémoire pour des raisons de
performance. Pour cette raison, il faut redémarrer le processus Python pour voir
les changement prendre effet. Avoir un processus séparé permet de le faire
sans avoir à redémarer le serveur.
Nginx
======
Nginx peut être installé avec votre gestionnaire de paquets habituels, donc
nous ne couvrirons pas cette partie.
Vous devez créer une fichier de configuration Nginx pour 0bin. Sous GNU/Linux,
on les mets en général dans /etc/nginx/conf.d/. Nommez le zerobin.conf.
Le fichier minimal pour faire tourner le site est:
Mais on peut apporter plusieurs améliorations de performance:

209
docs/fr/options.rst Normal file
View File

@ -0,0 +1,209 @@
============
Options
============
Le comportement de 0bin peut être ajusté à l'aide d'options passées depuis un
fichier de configuration ou directement à la ligne de commande. Certains
paramètres sont uniquement disponibles dans le fichier de configuration.
Si une option n'est pas passée, 0bin utilise la valeur par
défaut présente dans le fichier zerobin/default_settings.py.
Ligne de commande
==================
--host et --port
-------------------
L'hôte et le port sur lesquels écouter les requêtes entrantes. En général
127.0.0.1 et 8000 pour écouter localement, ou 0.0.0.0 et 80 pour
écouter les requêtes extérieures.
Défaut: 127.0.0.1 et 8000
Equivalent du fichier de configuration : HOST et PORT
--debug
----------
Afffiche un listing d'informations utiles pour déboguer quand quelque chose
se passe mal à la place d'une page d'erreur 500.
En mode debug, le serveur recharge aussi automatiquement tout fichier Python
modifié.
Défaut: False
Equivalent du fichier de configuration : DEBUG
--user et --group
-------------------
L'utilisateur et le group que le serveur essayera d'adopter après le démarrage.
Utile quand on lance la commande avec les droits admin afin de pouvoir
écouter sur le port 80, mais qu'on souhaite, pour des raisons de sécurité, que
le processus n'est pas accès aux fichiers protégés du système.
--group prend de --user si il n'est pas précisé.
Défaut: Aucun
Equivalent du fichier de configuration : USER et GROUP
--settings-file
-----------------
Chemin vers le fichier de configuration, si vous souhaitez en utiliser un.
Défaut: Aucun
Equivalent du fichier de configuration : Aucun
--compressed-static
--------------------
Sert les versions minifiées fichiers statiques (css et js). A utiliser en
production pour un site plus rapide.
Défaut: False
Equivalent du fichier de configuration : COMPRESSED_STATIC_FILES
--version et --help
--------------------
Affiche l'aide ou la version de 0bin
Défaut: Aucun
Equivalent du fichier de configuration : Aucun
Exemples
----------
Production::
sudo zerobin --host 0.0.0.0 --port 80 --user foo --compressed-static
Développement::
zerobin --debug --serve-static
Fichier de configuration
========================
Le fichier configuration doit être un fichier Python ordinnaire, généralement
appelé settings.py. On l'utilise ainsi::
zerobin --settings-file '/chemin/vers/settings.py'
Toutes les autres options passées à la commandes auront priorité sur les options
du fichier de configuration. Le fichier zerobin/default_settings.py peut servir
d'exemple pour créer son propre fichier de configuration, il est largement commenté.
DEBUG
-----
Afffiche un listing d'informations utiles pour déboguer quand quelque chose
se passe mal à la place d'une page d'erreur 500.
En mode debug, le serveur recharge aussi automatiquement tout fichier Python
modifié.
Défaut: False
Equivalent en ligne de commande : --debug
STATIC_FILES_ROOT
------------------
Chemin absolu du dossier dans lequel 0bin va chercher les fichiers statiques
(css, js et images).
Défaut: dossier "static" dans le dossier "zerobin"
Equivalent en ligne de commande : Aucun
COMPRESSED_STATIC_FILES
-------------------------
Sert les versions minifiées fichiers statiques (css et js). A utiliser en
production pour un site plus rapide.
Défaut: False
Equivalent en ligne de commande : --compressed-static
PASTE_FILES_ROOT
-----------------
Chemin absolu du dossier dans lequel 0bin va sauvegarder les pastes.
Défaut: dossier "static/content" dans le dossier "zerobin"
Equivalent en ligne de commande : Aucun
TEMPLATE_DIRS
--------------
Liste des chemins absolus des dossiers qui contiennent les templates que 0bin
utilise pour générer les pages du site. Les premiers éléments de la liste
ont priorités sur les suivant.
Si vous voulez utiliser vos propres templates, ajoutez le dossier qui les
contient au début de la liste::
from zerobin.defauls_settings import TEMPLATE_DIRS
TEMPLATE_DIRS = (
'/chemin/version/votre/dossier/de/templates',
) + TEMPLATE_DIRS
Défaut: dossier "view" dans le dossier "zerobin"
Equivalent en ligne de commande : Aucun
HOST et PORT
-------------------
L'hôte et le port sur lesquels écouter les requêtes entrantes. En général
127.0.0.1 et 8000 pour écouter localement, ou 0.0.0.0 et 80 pour
écouter les requêtes extérieures.
Défaut: 127.0.0.1 et 8000
Equivalent du fichier de configuration : --host et --port
USER et GROUP
-------------------
L'utilisateur et le group que le serveur essayera d'adopter après le démarrage.
Utile quand on lance la commande avec les droits admin afin de pouvoir
écouter sur le port 80, mais qu'on souhaite, pour des raisons de sécurité, que
le processus n'est pas accès au fichiers système.
GROUP prend de USER si il n'est pas précisé.
Défaut: Aucun
Equivalent du fichier de configuration : --user et --group
MENU
------
Une liste de paires 'Nom' + 'Liens' à utiliser pour construire le menu qui
est en haut de chaque page.
Le lien peut être un lien relatif, absolu, ou une adresse email.
Toute addresse email sera automatiquement protégée contre le spam.
Défaut::
MENU = (
('Home', '/'),
('Download 0bin', 'https://github.com/sametmax/0bin'),
('Contact', 'mailto:your@email.com') # email
)
Equivalent en ligne de commande : Aucun
MAX_SIZE
---------
Valeur approximative de limite de taille d'un paste.
Défaut = 500000 octets (500 ko)
Equivalent en ligne de commande : Aucun

View File

@ -1,3 +1,22 @@
=========================
Personnaliser l'apparence
=========================
=========================
0bin possède un support de theming complet, mais pour le moment mal intégré.
Si vous souhaitez créer votre propre theme, il vous faut créer des templates
similaires à ceux par défault présents dans zerobin/view, et
ajouter le chemin du dossier contenant ces templates au fichier de settings.
Vous aurez également besoin de copier les fichiers statiques présent
dans zerobin/static dans un nouveau dossier, puis les modifier. Et signifier
que vous utilisez ce dossier dans le fichiers de settings.
Vous pouvez bien entendu également éditez tous les fichier directement par
souci de simplicité.
Attention cependant, le code javascript est très dépendant des ID et classes
du HTML, qui ne sont pour le moment pas très bien organisés.
Si vous avez de sérieux besoin de theming, contactez-nous, afin que nous
améliorons le support.

View File

@ -1,8 +1,3 @@
.. 0bin documentation master file, created by
sphinx-quickstart on Mon May 7 13:31:25 2012.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
0bin's documentation
======================
@ -10,26 +5,26 @@
* Try it: `0bin.net <http://0bin.net>`_
* Get the `source on github <https://github.com/sametmax/0bin>`_
* `Report a bug <https://github.com/sametmax/0bin/issues>`_
.. http://www.sensefulsolutions.com/2010/10/format-text-as-table.html
+-------------------------+----------------------------+
| English | Français |
+-------------------------+----------------------------+
| | |
|.. toctree:: |.. toctree:: |
| :maxdepth: 1 | :maxdepth: 1 |
| | |
| en/intro | fr/intro |
| en/easy_install | fr/easy_install |
| en/apache_install | fr/apache_install |
| en/nginx_install | fr/nginx_install |
| en/using_supervisor | fr/using_supervisor |
| en/theming | fr/theming |
| | |
| |`Signaler un bug`_ |
+-------------------------+----------------------------+
+-------------------------+--------------------------------+
| English | Français |
+-------------------------+--------------------------------+
| | |
|.. toctree:: |.. toctree:: |
| :maxdepth: 1 | :maxdepth: 1 |
| | |
| en/intro | fr/intro |
| en/easy_install | fr/easy_install |
| en/apache_install | fr/apache_install |
| en/nginx_install | fr/nginx_install |
| en/using_supervisor | fr/using_supervisor |
| en/theming | fr/theming |
| en/options | fr/options |
| | |
|`Report a bug`_ |`Signaler un bug`_ |
+-------------------------+--------------------------------+
Indices and tables
@ -39,4 +34,5 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`
.. _Signaler un bug: https://github.com/sametmax/0bin/issues
.. _Signaler un bug: https://github.com/sametmax/0bin/issues
.. _Report a bug: <https://github.com/sametmax/0bin/issues>

View File

@ -2,4 +2,6 @@
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
VERSION = __version__ = "0.1"
from default_settings import VERSION
__version__ = VERSION

View File

@ -7,6 +7,7 @@
import os
import math
VERSION = '0.1'
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
LIBS_DIR = os.path.join(os.path.dirname(ROOT_DIR), 'libs')
@ -25,7 +26,7 @@ STATIC_FILES_ROOT = os.path.join(ROOT_DIR, 'static')
# If True, will link the compressed verion of the js and css files,
# otherwise, will use the ordinary files
COMPRESSED_STATIC_FILES = not DEBUG
COMPRESSED_STATIC_FILES = False
# absolute path where the paste files should be store
# default in projectdirectory/static/content/
@ -60,7 +61,6 @@ MENU = (
('Contact', 'mailto:your@email.com') # email
)
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
# browser
# limit size of pasted text in bytes. Be carefull allowing too much size can
# slow down user's browser
MAX_SIZE = 1024 * 500
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))

View File

@ -7,6 +7,8 @@
server run.
"""
import os
import sys
import thread
from datetime import datetime, timedelta
@ -104,17 +106,25 @@ def error404(code):
return GLOBAL_CONTEXT
@app.route('/static/<filename:path>')
def server_static(filename):
return static_file(filename, root=settings.STATIC_FILES_ROOT)
@clize.clize(coerce={'debug': bool, 'compressed_static': bool})
def runserver(host='', port='', debug=None, serve_static='', user='',
group='', settings_file='', compressed_static=None):
def runserver(host='', port='', debug=None, user='',
group='', settings_file='', compressed_static=None, version=False):
if version:
print '0bin V%s' % settings.VERSION
sys.exit(0)
# merge the settings
if settings_file:
settings.update_with_file(settings_file)
settings.update_with_file(os.path.abspath(settings_file))
settings.HOST = host or settings.HOST
settings.PORT = port or settings.PORT
settings.STATIC_FILES_ROOT = serve_static or settings.STATIC_FILES_ROOT
settings.USER = user or settings.USER
settings.GROUP = group or settings.GROUP
@ -128,10 +138,6 @@ def runserver(host='', port='', debug=None, serve_static='', user='',
for d in reversed(settings.TEMPLATE_DIRS):
bottle.TEMPLATE_PATH.insert(0, d)
if settings.STATIC_FILES_ROOT:
@app.route('/static/<filename:path>')
def server_static(filename):
return static_file(filename, root=settings.STATIC_FILES_ROOT)
thread.start_new_thread(drop_privileges, (settings.USER, settings.GROUP))