<?xml 
version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="https://www.steletch.org/spip.php?page=backend.xslt" ?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:atom="http://www.w3.org/2005/Atom"
>

<channel xml:lang="fr">
	<title>Molecular Modelling and GNU/Linux</title>
	<link>https://www.steletch.org/</link>
	<description></description>
	<language>fr</language>
	<generator>SPIP - www.spip.net</generator>
	<atom:link href="https://www.steletch.org/spip.php?id_rubrique=4&amp;page=backend" rel="self" type="application/rss+xml" />

	<image>
		<title>Molecular Modelling and GNU/Linux</title>
		<url>https://www.steletch.org/local/cache-vignettes/L144xH82/dall.e_2024-12-12_22.09.02_-_a_cheerful_cartoon-style_penguin_resembling_the_gnu_linux_mascot_tux_depicted_happily_gazing_at_a_thought_bubble_above_its_head__inside_the_thought_-61205.webp?1734078381</url>
		<link>https://www.steletch.org/</link>
		<height>82</height>
		<width>144</width>
	</image>



<item xml:lang="fr">
		<title>Ajouter des polices Windows sous Ubuntu</title>
		<link>https://www.steletch.org/spip.php?page=article&amp;id_article=25</link>
		<guid isPermaLink="true">https://www.steletch.org/spip.php?page=article&amp;id_article=25</guid>
		<dc:date>2023-12-19T12:44:13Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>S. T&#233;letch&#233;a</dc:creator>



		<description>
&lt;p&gt;Les syst&#232;mes GNU/Linux contiennent de nombreuses polices de caract&#232;res qui sont largement suffisantes pour un usage du quotidien. Il peut cependant arriver que vous ayez &#224; travailler sur un document qui sera partag&#233; avec des coll&#232;gues sous Windows, qui utiliseront par d&#233;faut la police de caract&#232;res &#034;Calibri&#034;, ce qui rendra le rendu sous linux sous-optimal, car une police de remplacement sera affich&#233;e. &lt;br class='autobr' /&gt;
Pour installer les polices compl&#233;mentaires de celles du syst&#232;me, il est possible (&#8230;)&lt;/p&gt;


-
&lt;a href="https://www.steletch.org/spip.php?page=rubrique&amp;id_rubrique=4" rel="directory"&gt;SysAdmin&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_texte'&gt;&lt;p&gt;Les syst&#232;mes GNU/Linux contiennent de nombreuses polices de caract&#232;res qui sont largement suffisantes pour un usage du quotidien. Il peut cependant arriver que vous ayez &#224; travailler sur un document qui sera partag&#233; avec des coll&#232;gues sous Windows, qui utiliseront par d&#233;faut la police de caract&#232;res &#034;Calibri&#034;, ce qui rendra le rendu sous linux sous-optimal, car une police de remplacement sera affich&#233;e.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Pour installer les polices compl&#233;mentaires de celles du syst&#232;me, il est possible d'installer la police &#034;fonts-crosextra-carlito&#034; qui permettra d'avoir un rendu compatible avec celui que produirait la police Calibri (m&#234;me taille de caract&#232;res.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code spip_code_inline' dir='ltr'&gt;sudo apt install fonts-crosextra-carlito&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Il est aussi possible d'installer automatiquement quelques polices True Type Font (TTF) de Microsoft.&lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code spip_code_inline' dir='ltr'&gt;sudo apt install ttf-mscorefonts-installer&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pour ce qui est de la police &#034;Calibri&#034; &#224; proprement parler, il est possible de la t&#233;l&#233;charger ici : &lt;a href=&#034;https://www.fontpalace.com/font-download/Calibri/&#034; class=&#034;spip_out&#034; rel=&#034;external&#034;&gt;https://www.fontpalace.com/font-download/Calibri/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Une fois le fichier calibri.ttf, aller avec le navigateur de fichier (nautilus) sur son emplacement, faites un clic droit sur le fichier, s&#233;lectionnez &#034;Ouvrir avec Polices&#034;, puis une fois l'application lanc&#233;e, cliquez sur &#034;Installer&#034;.&lt;/p&gt;
&lt;p&gt;Vous avez ainsi enrichi rapidement votre distribution d'un certain nombre de polices classiques sous d'autres OS.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="en">
		<title>Django setup with rdkit for chemoinformatics studies</title>
		<link>https://www.steletch.org/spip.php?page=article&amp;id_article=17</link>
		<guid isPermaLink="true">https://www.steletch.org/spip.php?page=article&amp;id_article=17</guid>
		<dc:date>2023-08-17T18:18:19Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>en</dc:language>
		<dc:creator>S. T&#233;letch&#233;a</dc:creator>



		<description>
&lt;p&gt;Although Rdkit and Django installation and deployment are well documented independently, it may become rapidly difficult to a newcomer to get a simple rdkit + django implementation working using a real apache backend. This article will detail how they can be implemented and used for a small demonstration application. &lt;br class='autobr' /&gt;
Django setup &lt;br class='autobr' /&gt;
We will first create our django sample application using virtualenv and pip. &lt;br class='autobr' /&gt; virtualenv venv source venv/bin/activate pip install django==3.2.20 &lt;br class='autobr' /&gt;
Now that (&#8230;)&lt;/p&gt;


-
&lt;a href="https://www.steletch.org/spip.php?page=rubrique&amp;id_rubrique=4" rel="directory"&gt;SysAdmin&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_texte'&gt;&lt;!--sommaire--&gt;&lt;div class=&#034;well nav-sommaire nav-sommaire-4&#034; id=&#034;nav6a0a9f11557542.38140304&#034;&gt;
&lt;h2&gt;Table of contents&lt;/h2&gt;&lt;ol class=&#034;spip&#034; role=&#034;list&#034;&gt;&lt;li&gt; &lt;a id=&#034;s-Django-setup&#034;&gt;&lt;/a&gt;&lt;a href=&#034;#Django-setup&#034; class=&#034;spip_ancre&#034;&gt;Django setup&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a id=&#034;s-RdKit-installation-http-www-rdkit-org&#034;&gt;&lt;/a&gt;&lt;a href=&#034;#RdKit-installation-http-www-rdkit-org&#034; class=&#034;spip_ancre&#034;&gt;RdKit installation (http://www.rdkit.org)&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a id=&#034;s-Testing-rdkit-inside-django&#034;&gt;&lt;/a&gt;&lt;a href=&#034;#Testing-rdkit-inside-django&#034; class=&#034;spip_ancre&#034;&gt;Testing rdkit inside django&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a id=&#034;s-Migration-to-apache&#034;&gt;&lt;/a&gt;&lt;a href=&#034;#Migration-to-apache&#034; class=&#034;spip_ancre&#034;&gt;Migration to apache&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;!--/sommaire--&gt;&lt;p&gt;Although Rdkit and Django installation and deployment are well documented independently, it may become rapidly difficult to a newcomer to get a simple rdkit + django implementation working using a real apache backend. This article will detail how they can be implemented and used for a small demonstration application.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034; id='Django-setup'&gt;Django setup&lt;a class='sommaire-back sommaire-back-4' href='#s-Django-setup' title='Back to the table of contents'&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We will first create our django sample application &lt;a href='https://docs.python-guide.org/dev/virtualenvs/' target=&#034;_blank&#034;&gt;using virtualenv and pip&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt;virtualenv venv source venv/bin/activate pip install django==3.2.20&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now that the minimum requirements are met, it is time to start a new project called &lt;strong&gt;chemoinformaticsDemo&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&#034;python&#034;&gt;
&lt;pre&gt; &lt;code&gt;django-admin startproject chemoinformaticsDemo&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This will install django files and a subdirectory called again chemoinformaticsDemo where the projects settings will have to be updated. For now we can keep it as is.&lt;/p&gt;
&lt;p&gt;At this point we only need some dirs that will be filled in later.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt;cd chemoinformaticsDemo mkdir static mkdir chemoinformaticsDemo/templates&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;There is now the default infrastructure for the django project (without rdkit calls, see below). In order to get a proper django setup, we need to initalize the database for django models, mostly for authentication management at this step.&lt;/p&gt;
&lt;p&gt;This will install django files and a subdirectory called again chemoinformaticsDemo where the projects settings will have to be updated. For now we can keep it as is.&lt;/p&gt;
&lt;p&gt;At this point we only need some dirs that will be filled in later.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt;cd chemoinformaticsDemo mkdir static mkdir chemoinformaticsDemo/templates&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;There is now the default infrastructure for the django project (without rdkit calls, see below). In order to get a proper django setup, we need to initalize the database for django models, mostly for authentication management at this step.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code class=&#034;python&#034;&gt;python manage.py makemigrations python manage.py migrate&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;It you are really impatient, you can already start your application in the developper mode using:&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code class=&#034;python&#034;&gt;python manage.py runserver&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;To see the result you can fire up your browser and point to the location&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt;http://localhost:8000&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;To get something more specific, you can add a template in chemoinformaticsDemo/templates, for instance called base.html.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code class=&#034;html&#034;&gt;chemoinformaticsDemo/templates/base.html &lt;html lang=&#034;en&#034;&gt; &lt;head&gt; &lt;meta charset=&#034;utf-8&#034;&gt; &lt;/head&gt; &lt;body&gt; This is the starting page of the project. &lt;div id=&#034;content&#034;&gt; {% block content %}{% endblock content %} &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This page will be displayed via the urls mapping in django, so you have to specify a simple urls.py and views.py, as exemplified after.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt;chemoinformaticsDemo/urls.py from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = ( url(r'^$','chemoinformaticsDemo.views.home', name='home'), url(r'^admin/', include(admin.site.urls)), ) &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The corresponding views.py will be called from this url redirection.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; chemoinformaticsDemo/views.py from django.shortcuts import render from django.conf import settings def home(request): return render(request, 'home.html') &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you refresh the previously opened http page, you should now get a small message welcoming you:&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; This is the starting page of the project. &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;It is now time to add some content to the project, and especially to link rdkit with django.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034; id='RdKit-installation-http-www-rdkit-org'&gt;RdKit installation (&lt;a href=&#034;http://www.rdkit.org&#034; class=&#034;spip_url spip_out auto&#034; rel=&#034;nofollow external&#034;&gt;http://www.rdkit.org&lt;/a&gt;)&lt;a class='sommaire-back sommaire-back-4' href='#s-RdKit-installation-http-www-rdkit-org' title='Back to the table of contents'&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This installation was performed on Ubuntu 14.04.4 LTS 64bits.&lt;/p&gt;
&lt;p&gt;First download the latest rdkit tarball. ( &lt;a href=&#034;https://sourceforge.net/projects/rdkit/files/latest/download&#034; class=&#034;spip_url spip_out auto&#034; rel=&#034;nofollow external&#034;&gt;https://sourceforge.net/projects/rdkit/files/latest/download&lt;/a&gt; )&lt;br class='autobr' /&gt;
Decompress the archive, enter the rdkit directory and create a build directory, then use default options, except for the rdkit installation location:&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; cd /opt tar -zxvf RDKit_2016_03_1.tgz cd rdkit-Release_2016_03_1 mkdir build cd build sudo cmake .. sudo make install &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You will need sudo / root rights to write to the /opt directory.&lt;/p&gt;
&lt;p&gt;It is important to have rdkit paths available system-wide so Apache will also be able to find it properly. The easiest way is to indicate to the system where it should search for rdkit libraries. This is done by adding a file in the linker directory, in /etc/ld.so.conf.d/ (&lt;a href=&#034;https://howtolamp.com/articles/adding-shared-libraries-to-system-library-path/&#034; class=&#034;spip_url spip_out auto&#034; rel=&#034;nofollow external&#034;&gt;https://howtolamp.com/articles/adding-shared-libraries-to-system-library-path/&lt;/a&gt;). We can create a simple file called rdkit.conf, and update the dynamic loader cache to have rdkit included properly. In short:&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; sudo echo &#034;/opt/rdkit-Release_2016_03_1/lib&#034; &gt; /etc/ld.so.conf.d/rdkit.conf sudo ldconfig &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you want to be sure the library search now contains the RdKit path, just grep for it.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; grep -i rdkit /etc/ld.so.cache Binary file /etc/ld.so.cache matches &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You also need that rdkit is available for python programs out of you django environment.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type &#034;help&#034;, &#034;copyright&#034;, &#034;credits&#034; or &#034;license&#034; for more information. &gt;&gt;&gt; import sys &gt;&gt;&gt; sys.path.append('/opt/RDkit_2016_03_1') &gt;&gt;&gt; from rdkit import Chem &gt;&gt;&gt; quit() &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Please note that the /lib directory is not present&lt;/strong&gt; in the sys.path.append command because python bindings are present at the RDkit root.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034; id='Testing-rdkit-inside-django'&gt;Testing rdkit inside django&lt;a class='sommaire-back sommaire-back-4' href='#s-Testing-rdkit-inside-django' title='Back to the table of contents'&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now that everything is in place, we can test a simple but functionnal application. First we create a dedicated application called &lt;strong&gt;rdkitDemo&lt;/strong&gt; (and not simply rdkit otherwise there will be namespace collisions).&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; python manage.py startapp rdkitDemo mkdir rdkitDemo/templates &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You need to edit the chemoinformaticsDemo/settings.py to add to &#034;INSTALLED_APPS&#034; &lt;strong&gt;rdkitDemo&lt;/strong&gt; (using any text editor).&lt;br class='autobr' /&gt;
Now django has to take into account this new application, so migrate existing tables.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; python manage.py makemigrations python manage.py migrate &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Up-to-now since no modifications were made to the models (and therefore to the tables) there should be no error messages and no migrations detected.&lt;br class='autobr' /&gt;
To enrich you django project, we will add new urls to take into account &lt;strong&gt;rdkitDemo&lt;/strong&gt; and add a sample html file for showing a simple demonstration of rkdit.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; update to chemoinformaticsDemo/urls.py from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = ( url(r'^$','essai.views.home', name='home'), url(r'^admin/', include(admin.site.urls)), {{url(r'^rdkit/', include('rdkitDemo.urls')),}} ) &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The corresponding entry in the new application involves its own urls.py file.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; rdkitDemo/urls.py from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns('', url(r'^demo', 'rdkitDemo.views.simple_example', name='rdkit_simple_example'), ) &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;We can now set up a small demonstration of what can be accomplished with rdkit, for instance computing the 2D coordinates of beta galactose from its SMILES description in pubchem, and optimize its geometry in 3D (&lt;a href=&#034;https://pubchem.ncbi.nlm.nih.gov/compound/beta-D-galactose&#034; class=&#034;spip_url spip_out auto&#034; rel=&#034;nofollow external&#034;&gt;https://pubchem.ncbi.nlm.nih.gov/compound/beta-D-galactose&lt;/a&gt;). The generated molecule will be transformed into a 2D plot stored on the disk.&lt;/p&gt;
&lt;p&gt;To store the PNG file, add a subdirectory to the &lt;strong&gt;static&lt;/strong&gt; directory seen above.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; mkdir static/demo chmod 777 static/demo &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; the chmod will be used later, this is not mandatory for now and should also NOT be done on a production server...&lt;/p&gt;
&lt;p&gt;Now that everything is in place, we can add the necessary files in rdkitDemo.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; rdkitDemo/views.py from django.shortcuts import render from django.conf import settings from rdkit import Chem from rdkit.Chem import AllChem from rdkit import DataStructs from rdkit.Chem.Fingerprints import FingerprintMols from rdkit.Chem import Draw from PIL import Image # Create your views here. def simple_example(request): smiles_data='C([C@@H]1[C@@H]([C@@H]([C@H]([C@@H](O1)O)O)O)O)O' m = Chem.MolFromSmiles(smiles_data) # Code SMILES issu de pubchem # data=Chem.MolToMolBlock(m) # Unused, not pretty to display (yet) # 3D conversion and optimization m2=Chem.AddHs(m) AllChem.EmbedMolecule(m2) AllChem.MMFFOptimizeMolecule(m2) # more complex, better? # AllChem.UFFOptimizeMolecule(m) # faster, less stronger :-) Draw.MolToFile(m,settings.BASE_DIR+'/static/demo/test.png') toto=FingerprintMols.FingerprintMol(m) # not used return render(request,'demo.html', {'data':smiles_data}) &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;To display the result of the view, a new template is created, based on the &lt;strong&gt;base.html&lt;/strong&gt; file already available.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; rdkitDemo/templates/demo.html {% extends &#034;base.html&#034; %} {% load static %} {% block title %}Simple rdkit Demo{% endblock title %} {% block content %} Welcome to this demo project for the molecule described by {{ data }}.&lt;br /&gt; &lt;img src=&#034;{% static 'demo/test.png' %}&#034; alt=&#034;Image g&#233;n&#233;r&#233;e&#034; /&gt; &lt;footer style=&#034;text-align:right&#034;&gt; &lt;a href=&#034;{% url 'home' %}&#034;&gt;Back&lt;/a&gt; &lt;/footer&gt; {% endblock content %} &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If everything worked perfectly until here, you can start again your django project in developper mode, pay attention to update your manage.py file to extend the system path for rdkit. Pay also attention to spaces above if you copy/paste the code since python uses spaces (or abs) to indent the code and determine logical blocks.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; manage.py #!/usr/bin/env python import os import sys if __name__ == &#034;__main__&#034;: os.environ.setdefault(&#034;DJANGO_SETTINGS_MODULE&#034;, &#034;essai.settings&#034;) sys.path.append('/opt/RDkit_2016_03_1') from django.core.management import execute_from_command_line execute_from_command_line(sys.argv) &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You should now get a working rdkit + django installation in the developper mode for django.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; (venv)python manage.py runserver &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Reminder:&lt;/strong&gt; we are still in the virtualenvironment created at the beginning. If you get errors about PIL not found, just add it using pip, and do the same for any missing dependencies.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; pip install Pillow &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Only one step is needed to migrate this small application to a real server available for the community.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034; id='Migration-to-apache'&gt;Migration to apache&lt;a class='sommaire-back sommaire-back-4' href='#s-Migration-to-apache' title='Back to the table of contents'&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If everything is is place, you can now configure apache to use your virtual environment and rkdit. Assuming the virtual environment was stored in &lt;strong&gt;/home/stephane/example&lt;/strong&gt;, one needs to write the following apache configuration file.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; /etc/apache2/sites-available/rdkitDemo.conf &lt;VirtualHost *:80&gt; ServerName localhost ServerAlias localhost # Very important, see https://code.google.com/archive/p/modwsgi/wikis/ApplicationIssues.wiki#Python_Simplified_GIL_State_API WSGIApplicationGroup %{GLOBAL} # https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/ WSGIDaemonProcess essaiRdkit python-path=/home/stephane/example/chemoinformaticsDemo:/opt/RDkit_2016_03_1/:/home/stephane/example/chemoinformaticsDemo/django1.8/lib/python2.7/site-packages display-name=essaiRdkit WSGIProcessGroup essaiRdkit WSGIScriptAlias /essai '/home/stephane/example/chemoinformaticsDemo/chemoinformaticsDemo//wsgi.py' &lt;Directory /home/stephane/example/chemoinformaticsDemo/&gt; WSGIProcessGroup essaiRdkit &lt;Files wsgi.py&gt; Options +ExecCGI -MultiViews +FollowSymLinks AllowOverride None Require all granted &lt;/Files&gt; &lt;/Directory&gt; Alias /static /home/stephane/example/chemoinformaticsDemo/static/ &lt;Location /static/&gt; WSGIProcessGroup essaiRdkit Options -Indexes +FollowSymLinks Require all granted &lt;/Location&gt; # Pour s&#233;parer les bons logs de l'ivraie ErrorLog ${APACHE_LOG_DIR}/djangoprojects-error.log CustomLog ${APACHE_LOG_DIR}/djangoprojects-access.log combined &lt;/VirtualHost&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt; that we opened the door for apache writing with the &lt;strong&gt;chmod 777 to the demo subdir before&lt;/strong&gt;, THIS HAS TO BE CHANGED using a proper location for &lt;i&gt;www-data&lt;/i&gt; user access...&lt;/p&gt;
&lt;p&gt;Everything is now in place, activate the new virtual apache environment and reload apache configuration.&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; udo a2ensite rdkitDemo sudo service apache2 reload &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You should now have a great django web site to play with, just integrate your rdkit applications!&lt;br class='autobr' /&gt;
To ensure everything is up and running, open your brower to the location&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;
&lt;pre&gt; &lt;code&gt; http://localhost/essai/ &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;In case you will be in trouble, check apache logs in &lt;strong&gt;/var/log/apache2/djangoprojects-error.log&lt;/strong&gt;, they are isolated to better identify mistakes and / or copy/pasting errors.&lt;br class='autobr' /&gt;
Enjoy.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="en">
		<title>Adding timestamps in crontabs</title>
		<link>https://www.steletch.org/spip.php?page=article&amp;id_article=14</link>
		<guid isPermaLink="true">https://www.steletch.org/spip.php?page=article&amp;id_article=14</guid>
		<dc:date>2023-08-17T12:30:57Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>en</dc:language>
		<dc:creator>S. T&#233;letch&#233;a</dc:creator>



		<description>
&lt;p&gt;Crontab entries are great to periodically execute a command, but lack advanced logging facilities. This article will just highlight a rapid tip to enhance this situation. &lt;br class='autobr' /&gt;
The cron service is meant to execute periodically a given task, but it lacks a proper logging facility. &lt;br class='autobr' /&gt;
To add a specific unique logging entry, we will use a variable define inside the crontab command line. Here is the content of my command line &lt;br class='autobr' /&gt; LOG=/home/me/log/ PROGDIR=/home/me/bin &lt;br class='autobr' /&gt;
22 6 * * 1-7 (&#8230;)&lt;/p&gt;


-
&lt;a href="https://www.steletch.org/spip.php?page=rubrique&amp;id_rubrique=4" rel="directory"&gt;SysAdmin&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_texte'&gt;&lt;p&gt;Crontab entries are great to periodically execute a command, but lack advanced logging facilities. This article will just highlight a rapid tip to enhance this situation.&lt;/p&gt;
&lt;p&gt;The cron service is meant to execute periodically a given task, but it lacks a proper logging facility.&lt;/p&gt;
&lt;p&gt;To add a specific unique logging entry, we will use a variable define inside the crontab command line. Here is the content of my command line&lt;/p&gt;
&lt;div class=&#034;precode&#034;&gt;&lt;pre class='spip_code spip_code_block' dir='ltr' style='text-align:left;'&gt;&lt;code&gt;LOG=/home/me/log/ PROGDIR=/home/me/bin 22 6 * * 1-7 TIMSTP=&#034;date +\%Y\%m\%d-\%H\%M\%S&#034;; $PROGDIR/update_list.py 2&amp;1 &gt; $LOG/$TIMSTP-update_list.log&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command starting with 22 6 and ending with update_list.log is on the same line.&lt;/p&gt;
&lt;p&gt;First we define some variables which are not known by cron (LOG and PROGDIR paths), then we define a TIMSTP (timestamp) variable using the YYYYMMDD-hhmmss format, and execute the program &#034;update_list.py&#034;.&lt;/p&gt;
&lt;p&gt;In order to get debugging information if needed, we merge the standard ouput (&amp;&gt;1) and the standard error, and redirect both output in one file, assembled from the LOG variables define for the whoel crontab, and the TMSTP variable, specific to this execution line.&lt;/p&gt;
&lt;p&gt;Note that you MUST use this syntax, using the date command out of the crontab execution line will not work.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>



</channel>

</rss>
