<?xml version="1.0" encoding="UTF-8"?><rss 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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Daxita Rajput on Medium]]></title>
        <description><![CDATA[Stories by Daxita Rajput on Medium]]></description>
        <link>https://medium.com/@daxita2013?source=rss-28ceb9c10ac5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*lAdHOJiqsldUAJ3jh6yRSw.jpeg</url>
            <title>Stories by Daxita Rajput on Medium</title>
            <link>https://medium.com/@daxita2013?source=rss-28ceb9c10ac5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 08:23:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daxita2013/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to separate django settings file?]]></title>
            <link>https://medium.com/@daxita2013/how-to-separate-django-settings-file-9f8b0fc2f809?source=rss-28ceb9c10ac5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f8b0fc2f809</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[settings]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[separation]]></category>
            <dc:creator><![CDATA[Daxita Rajput]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 12:33:47 GMT</pubDate>
            <atom:updated>2019-08-14T12:33:47.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6uUClat70JEtMxTmLrfsUA.png" /></figure><p>In Django Project, We have Project Folder and it contains settings.py file. This File have all the settings or configurations of our project.</p><p>settings.py is a core file in django project. It contains all the configuration values that your web app needs to work, like database settings, Logging configuration, STATIC file configuration, MEDIA file configuration, API keys If works with external API and all.</p><h3>The Problem</h3><p>Main Problem is local environment and deployment environment not same, and we have defined all the configuration as our local machine. It may occur huge problem at deployment environment.</p><p>What problem is, storage of all the images, videos at AWS. And this AWS configurations are in settings.py file. So If created data from local or staging was stored at AWS. And so much junk data was stored in AWS bucket.</p><p>Now good way in which we can solve this problem.</p><h3>Solution</h3><p>Main settings.py file is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f0236b75ce449006f02e42f6d5d34aa/href">https://medium.com/media/3f0236b75ce449006f02e42f6d5d34aa/href</a></iframe><p>Now We should create 3 files from one main settings.py file.</p><ol><li>settings/common.py</li><li>settings/local.py</li><li>settings/production.py</li></ol><p>Now let’s separate this settings.py file.</p><ol><li>Now common.py file contains common configurations of local and production, so easily we can use it. Here is common.py file:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dee7a1d5f731f613393fb23e4eb49923/href">https://medium.com/media/dee7a1d5f731f613393fb23e4eb49923/href</a></iframe><p>2. Now we just need to import this common.py file in local.py and production.py .Here is local.py file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/195eeccb3c88b7510c22fbeed2621237/href">https://medium.com/media/195eeccb3c88b7510c22fbeed2621237/href</a></iframe><p>You can see how the settings can easily modifiable in case of any doubt. This is the main profit of separating the settings.py file.</p><p>3. Here is production.py file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1224b8cd82ef9f376c02eb9de89d20a1/href">https://medium.com/media/1224b8cd82ef9f376c02eb9de89d20a1/href</a></iframe><p>How pretty it is!!</p><p>Thanks for Reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f8b0fc2f809" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django Translation]]></title>
            <link>https://medium.com/@daxita2013/django-translation-b9ecdd723285?source=rss-28ceb9c10ac5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9ecdd723285</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[translation]]></category>
            <dc:creator><![CDATA[Daxita Rajput]]></dc:creator>
            <pubDate>Thu, 08 Aug 2019 11:40:08 GMT</pubDate>
            <atom:updated>2019-08-08T11:40:08.304Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4INXcjaQwxI_8T3bGtB4Eg.jpeg" /></figure><p>Here we learn how to easily do translation in Django, the popular Python web framework.</p><p>We assume, that you have a working Django application and that you have installed gettext (for example via pip install gettext). If you have not used Django before, you maybe want to take a look at the <a href="https://docs.djangoproject.com/en/1.11/intro/tutorial01/">official tutorial</a> first and come back later.</p><p>So let’s start….</p><p>Let say we have project called website and an application called mysite .</p><p>The first step is to make sure that you have activated internationalization in your configuration. To do this, you have to make the following changes to website/settings.py:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5c564f33dcc1cde9a8bb4342b84cee4/href">https://medium.com/media/d5c564f33dcc1cde9a8bb4342b84cee4/href</a></iframe><p>Now let’s change in Templates.</p><h3>Internationalize Templates</h3><p>Then you have to mark all strings which have to be translated. Suppose you have template file</p><p>mysite/templates/mysite/dashboard.html</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eeb2e2f9fc85c7004afdd9fced2c36d4/href">https://medium.com/media/eeb2e2f9fc85c7004afdd9fced2c36d4/href</a></iframe><p>Now, for translate this &lt;h1&gt; and &lt;p&gt; Your file looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/881875db4f107e15a33892e447509a0c/href">https://medium.com/media/881875db4f107e15a33892e447509a0c/href</a></iframe><p>Fine, we import the localization package and replace all text with {% trans ‘text’ %} Here, we are using default text as a trans label, but we can make another, if want.</p><h3>Create Translation Files</h3><p>Now we have to create the translation files for every locale(languages), we want to support. To do this create the directory mysite/locale and inside the directory mysite run</p><p>django-admin makemessage -l ja</p><p>Here we use ja which supports japanese language, you can replace ja with the locale code of the language you like to add. This command will create the gettext file mysite/locale/ja/LC_MESSAGES/django.po with the content</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dea08400bf6cdcf90394fb14cd39ffe9/href">https://medium.com/media/dea08400bf6cdcf90394fb14cd39ffe9/href</a></iframe><h4>Now you can fill the translation strings here:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed51029aacebc482b166442b67e2059d/href">https://medium.com/media/ed51029aacebc482b166442b67e2059d/href</a></iframe><p>When you finish translating the string, you have to compile all these messages using following command:</p><p>django-admin compilemessages</p><p>Now check that your translations work or not , you have to change the language code inside website/settings.py like so</p><p>LANGUAGE_CODE = ‘ja’</p><p>This will set default language code as japanese language.</p><p>Now, If you have created any view for this template and created an url for that view like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/daa0e89708229baba9432b7284254697/href">https://medium.com/media/daa0e89708229baba9432b7284254697/href</a></iframe><p>Then on redering of this url, django will automatic append /ja after domain and our page will automatically converts in japanese language.</p><p>You can support more than one languages using this localization.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9ecdd723285" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>