<?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 Shabeer Ayar on Medium]]></title>
        <description><![CDATA[Stories by Shabeer Ayar on Medium]]></description>
        <link>https://medium.com/@ayarshabeer?source=rss-7e65ad994d2e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PyelSzR4664yk7A8EP2Tuw.jpeg</url>
            <title>Stories by Shabeer Ayar on Medium</title>
            <link>https://medium.com/@ayarshabeer?source=rss-7e65ad994d2e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ayarshabeer/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[Understanding Workers, Single-Threaded, and Multi-Threaded Execution in Django]]></title>
            <link>https://medium.com/@ayarshabeer/understanding-workers-single-threaded-and-multi-threaded-execution-in-django-855654d43575?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/855654d43575</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[uvicorn]]></category>
            <category><![CDATA[gunicorn]]></category>
            <category><![CDATA[multithreading]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 07:40:30 GMT</pubDate>
            <atom:updated>2025-02-18T07:40:30.936Z</atom:updated>
            <content:encoded><![CDATA[<p>When building a Django application, one of the biggest challenges is <strong>scalability</strong> — handling multiple users efficiently without slowing down. Since Django runs on Python, which is single-threaded due to the <strong>Global Interpreter Lock (GIL)</strong>, how does it serve thousands of requests? How do workers and multi-threading improve performance?</p><p>This blog post breaks it all down!</p><h3><strong>1. Single-Threaded vs. Multi-Threaded Execution</strong></h3><h4><strong>What Does “Single-Threaded” Mean in Python?</strong></h4><p>Python’s default execution model runs <strong>one request at a time per thread</strong>. This is due to the <strong>Global Interpreter Lock (GIL)</strong>, which prevents multiple threads from executing Python byte code at the same time.</p><p>So, if a Django app is <strong>single-threaded</strong>, it means:</p><ol><li><em>It can only process one request per worker at a time.</em></li><li><em>While waiting for the database or external API, it blocks other requests.</em></li></ol><p><strong>What About Multi-Threaded Execution?</strong></p><p>In a <strong>multi-threaded setup</strong>, a worker can handle multiple requests simultaneously by switching between them efficiently. However:</p><ol><li><em>Multiple threads handle different requests in the same worker.</em></li><li><em>I/O-bound tasks (like database queries) can continue while waiting.</em></li><li><em>But Python’s GIL prevents true parallel execution for CPU-heavy tasks.</em></li></ol><p>In Django, WSGI servers (like Gunicorn) often use multiple worker processes instead of threads to bypass the GIL limitation.</p><h3><strong>2. How Django Handles Multiple Requests?</strong></h3><p>Since Django is not a web server itself, it relies on WSGI or ASGI servers like:</p><p>• <strong>Gunicorn</strong> (WSGI, multi-process)</p><p>• <strong>Uvicorn/Daphne</strong> (ASGI, event-driven for async support)</p><p><strong>What Happens When a User Sends a Request?</strong></p><p><em>1️. The request reaches the WSGI/ASGI server (e.g., Gunicorn).</em></p><p><em>2️. The server assigns it to a worker (either a process or a thread).</em></p><p><em>3️. The worker processes the request and sends the response.</em></p><p><em>4️. If there are no available workers, the request waits in a queue.</em></p><p>The number of requests your Django app can handle <strong>depends on the number of workers and their threading model</strong>.</p><h3><strong>3. Understanding Workers in Django Deployment</strong></h3><p>A <strong>worker</strong> is responsible for handling requests. The number of workers determines <strong>how many requests can be processed in parallel</strong>.</p><p><strong>Worker Types in Gunicorn</strong></p><pre>| Worker Type      | Description                               | Best Use Case                  |<br>-------------------------------------------------------------------------------------------------<br>| Sync Workers     | Default, single-threaded, blocks on I/O.  | Simple apps, low traffic.<br>| Threaded Workers | Uses multiple threads per worker process. | I/O-heavy apps (DB queries, APIs).<br>| Async Workers    | Uses an event loop (gevent, asyncio).     | WebSockets, real-time features.<br>-------------------------------------------------------------------------------------------------</pre><p><strong>How Many Requests Can 2 Workers Handle?</strong></p><p>Let’s say we configure Gunicorn with 2 workers:</p><p>• If each worker is single-threaded, it can handle 2 concurrent requests.</p><p>• If each worker has 4 threads, it can handle 8 concurrent requests.</p><p>Formula:</p><p>Max Requests = Workers x Threads per Worker</p><p><strong>Example:</strong></p><p>If gunicorn — workers=4 — threads=2, Django can handle <strong>4 × 2 = 8 concurrent requests</strong>.</p><h3><strong>4. When to Use ASGI (Uvicorn/Daphne) Instead of WSGI?</strong></h3><p>• <strong>WSGI (Gunicorn)</strong> is <strong>blocking</strong>: It works well for standard Django apps (sync requests).</p><p>• <strong>ASGI (Uvicorn/Daphne)</strong> is <strong>non-blocking</strong>: It supports <strong>async views, WebSockets, and long-running connections</strong>.</p><p><strong>When to use ASGI?</strong></p><ol><li><em>If your app has WebSockets (real-time messaging).</em></li><li><em>If you have long-lived requests (e.g., streaming data).</em></li><li><em>If you need high concurrency with async functions.</em></li></ol><h3><strong>5. Final Takeaways</strong></h3><ol><li><em>Gunicorn with multiple workers can handle many concurrent requests.</em></li><li><em>Multi-threaded workers help for I/O-bound tasks (DB queries, API calls).</em></li><li><em>ASGI (Uvicorn) is better for real-time applications like WebSockets.</em></li></ol><p>If you’re setting up Django for production, the right configuration depends on your app’s workload and traffic.</p><p>Would you like help with configuring <strong>Gunicorn, or ASGI deployment</strong> for your Django app? Let’s discuss! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=855654d43575" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UV: Making Python Package Management Fast and Simple]]></title>
            <link>https://medium.com/@ayarshabeer/uv-making-python-package-management-fast-and-simple-a93e2af762ba?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a93e2af762ba</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[virtual-environment]]></category>
            <category><![CDATA[uv]]></category>
            <category><![CDATA[package-management]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Wed, 22 Jan 2025 08:38:28 GMT</pubDate>
            <atom:updated>2025-01-22T08:38:28.163Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s7g9mXFiaAHXlAyU.png" /></figure><p>Python package management has always been a bit slow. If you’ve worked on Python projects, you know the wait when running “pip install”. But there&#39;s good news - UV is here to change that.</p><h3>What is UV?</h3><p>UV is a new Python package manager written in Rust. It does the same job as pip but much faster. Think of it as pip’s speedier cousin.</p><h3>Why Should You Care?</h3><p>Simple — it saves time. Here’s what UV does better:</p><ol><li>It’s really fast — about 10–100x faster than pip</li><li>Works with your existing project setup</li><li>Handles both packages and Python versions</li></ol><h3>Getting Started</h3><p>First, let’s install UV:</p><pre>curl -LsSf https://astral.sh/uv/install.sh | sh</pre><p>Now, let’s see UV in action. Here’s how to create a new project:</p><pre># Create a new virtual environment uv venv # Activate it (on Unix systems) source .venv/bin/activate # Install some packages uv pip install flask pandas# Create a new virtual environment<br>uv venv<br><br># Activate it (on Unix systems)<br>source .venv/bin/activate<br><br># Install some packages<br>uv pip install flask pandas</pre><h3>Real-World Example</h3><p>Let’s say you’re building a web app. Here’s how UV makes it easier:</p><pre># Create a requirements.txt file<br>uv pip freeze &gt; requirements.txt<br><br># Install dependencies in a new environment<br>uv pip sync requirements.txt</pre><h3>Key Features That Matter</h3><h3>Fast Installation</h3><p>UV installs packages in parallel. What used to take minutes now takes seconds.</p><h3>Smart Caching</h3><p>UV remembers what you’ve installed before. No more downloading the same packages over and over.</p><h3>Python Version Management</h3><p>Need Python 3.10 for one project and 3.11 for another? UV handles that:uv python install 3.11 uv python install 3.10</p><pre>uv python install 3.11<br>uv python install 3.10</pre><h3>Common Tasks Made Simple</h3><h3>Working with Requirements Files</h3><pre># Generate requirements.txt<br>uv pip freeze &gt; requirements.txt<br><br># Install from requirements.txt<br>uv pip install -r requirements.txt</pre><h3>Managing Virtual Environments</h3><pre># Create a venv<br>uv venv<br><br># Remove a venv<br>rm -rf .venv</pre><h3>When to Use UV</h3><p>UV is great for:</p><ul><li>New Python projects where you want fast setup</li><li>CI/CD pipelines where speed matters</li><li>Projects with lots of dependencies</li><li>Teams that need consistent Python versions</li></ul><h3>Should You Switch?</h3><p>If you’re happy with pip, you don’t need to switch right away. But if you want faster package installation and simpler Python version management, UV is worth trying.</p><h3>Tips for Success</h3><ul><li>Keep your requirements.txt up to date</li><li>Use UV’s cache to speed up installations</li><li>Try UV in a test project first</li><li>Remember UV works alongside pip — you don’t have to choose one or the other</li></ul><h3>Wrapping Up</h3><p>UV makes Python package management faster and simpler. It’s not trying to replace everything — it just does common tasks better. Give it a try on your next project. Checkout official doc: <a href="https://docs.astral.sh/uv">https://docs.astral.sh/uv</a></p><p>Remember: You can still use your familiar pip commands with UV. Just add uv pip instead of pip and you&#39;re good to go.</p><p><em>Originally published at </em><a href="https://www.ayarshabeer.com/p/uv-making-python-package-management"><em>https://www.ayarshabeer.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a93e2af762ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Pyenv: Effective Management of Multiple Python Environments]]></title>
            <link>https://medium.com/@ayarshabeer/unlocking-pyenv-effective-management-of-multiple-python-environments-2cfb375aa141?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cfb375aa141</guid>
            <category><![CDATA[python-virtualenv]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[pyenv]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Mon, 30 Oct 2023 09:26:58 GMT</pubDate>
            <atom:updated>2023-12-15T06:55:36.811Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of Python development, staying efficient and organized is key to success. Whether you’re a seasoned developer or just starting, managing Python versions and virtual environments can be a challenge. In this guide, we’ll explore a tool that simplifies this process without the complexity of technical jargon.</p><h3>Seamlessly Navigating Python Versions</h3><p>Diverse projects demand different Python versions, and manually juggling between them can be a headache. Enter Pyenv, the game-changer. Pyenv allows effortless installation, management, and switching between various Python versions. Say goodbye to version conflicts and compatibility headaches.</p><h3>Getting Started with pyenv</h3><p>Setting up Pyenv is as simple as following a few steps. First, installing Pyenv is straightforward and can be accomplished in just a few steps. Once set up, Pyenv allows you to install specific Python versions and make them the default for your projects.</p><ol><li><strong>Installing Pyenv on macOS</strong></li></ol><pre>brew install pyenv<br>brew install pyenv-virtualenv</pre><p>for bash:</p><pre>echo &#39;export PYENV_ROOT=&quot;$HOME/.pyenv&quot;&#39; &gt;&gt; ~/.bash_profile<br>echo &#39;export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;&#39; &gt;&gt; ~/.bash_profile<br>echo -e &#39;if command -v pyenv 1&gt;/dev/null 2&gt;&amp;1; then\n  eval &quot;$(pyenv init --path)&quot;\nfi&#39; &gt;&gt; ~/.bash_profile<br>source ~/.bash_profile</pre><p>for Zsh:</p><pre>echo &#39;export PYENV_ROOT=&quot;$HOME/.pyenv&quot;&#39; &gt;&gt; ~/.zshrc<br>echo &#39;[[ -d $PYENV_ROOT/bin ]] &amp;&amp; export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;&#39; &gt;&gt; ~/.zshrc<br>echo &#39;eval &quot;$(pyenv init -)&quot;&#39; &gt;&gt; ~/.zshrc</pre><p><strong>2. Installing Pyenv on Linux</strong></p><p>On Linux distributions, the process is similar. For Ubuntu or Debian-based systems, you might need to install some prerequisites first:</p><pre>sudo apt-get update<br>sudo apt-get install git curl build-essential libssl-dev zlib1g-dev libbz2-dev \<br>libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev<br><br>curl https://pyenv.run | bash<br>echo &#39;export PYENV_ROOT=&quot;$HOME/.pyenv&quot;&#39; &gt;&gt; ~/.bashrc<br>echo &#39;export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;&#39; &gt;&gt; ~/.bashrc<br>echo -e &#39;if command -v pyenv 1&gt;/dev/null 2&gt;&amp;1; then\n  eval &quot;$(pyenv init --path)&quot;\nfi&#39; &gt;&gt; ~/.bashrc<br>source ~/.bashrc</pre><p><strong>3. Installing Pyenv on Windows</strong></p><p>Please note that Pyenv isn’t officially supported on Windows. For Windows users, consider using<a href="https://github.com/pyenv-win/pyenv-win">pyenv-win</a>, which installs native Windows Python versions.</p><p><strong>4. Installing Pyenv on Other Unix-like Systems</strong></p><p>For other Unix-like systems, you can use the following commands:</p><pre>git clone https://github.com/pyenv/pyenv.git ~/.pyenv<br>echo &#39;export PYENV_ROOT=&quot;$HOME/.pyenv&quot;&#39; &gt;&gt; ~/.bash_profile<br>echo &#39;export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;&#39; &gt;&gt; ~/.bash_profile<br>echo -e &#39;if command -v pyenv 1&gt;/dev/null 2&gt;&amp;1; then\n  eval &quot;$(pyenv init --path)&quot;\nfi&#39; &gt;&gt; ~/.bash_profile<br>source ~/.bash_profile</pre><p><strong>5. Managing Python Versions</strong></p><p>To list the available Python versions:</p><pre>pyenv versions</pre><p>To install specific Python versions:</p><pre>pyenv install 3.10.10<br>pyenv install 3.11.2</pre><h3>Effortless Virtual Environments</h3><p>Creating isolated environments for each project is pivotal. It ensures that project dependencies remain separate. Pyenv simplifies this too.</p><ol><li><strong>Creating a Virtual Environment:</strong></li></ol><pre>pyenv virtualenv 3.11.2 myenv</pre><p>2. <strong>Activating and deactivating environments:</strong></p><pre>pyenv activate myenv<br>pyenv deactivate</pre><h3>Benefits of Pyenv and Virtual Environments</h3><ol><li><strong>Version Isolation:</strong> Keep your project environments isolated, preventing conflicts and ensuring compatibility with project-specific dependencies.</li><li><strong>Efficient Workflow:</strong> Streamline your workflow by effortlessly switching between different Python versions and virtual environments, saving time and reducing errors.</li><li><strong>Collaboration Made Easy: </strong>When collaborating on projects, specify the project’s virtual environment to ensure everyone works with the same configurations, fostering seamless collaboration.</li><li><strong>Dependency Management:</strong> Manage project-specific packages and libraries within individual environments, avoiding conflicts and maintaining project stability.</li></ol><h3>Conclusion</h3><p>By mastering Pyenv’s Python version management and virtual environment capabilities, you empower yourself to handle diverse projects seamlessly. Whether you’re a lone developer or part of a team, Pyenv ensures you can effortlessly manage different Python versions and project-specific dependencies. So, integrate Pyenv into your workflow and bid farewell to the worries of version management. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cfb375aa141" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Read this before considering a lifetime deal for your SaaS.]]></title>
            <link>https://medium.com/@ayarshabeer/read-this-before-considering-a-lifetime-deal-for-your-saas-377aeacd656e?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/377aeacd656e</guid>
            <category><![CDATA[appsumo]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[lifetime-deals]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Fri, 14 Apr 2023 09:27:17 GMT</pubDate>
            <atom:updated>2023-04-14T09:27:17.499Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most crucial choices you’ll have to make as a SaaS (Software as a Service) creator is how much to charge for your offering. Offering lifetime deals to customers, which allow for a one-time purchase for access to your product for as long as it’s available, is a common pricing approach for SaaS providers. While lifetime contracts may have some advantages, they may also have disadvantages that should be carefully weighed before making an offer. Let’s examine the benefits and drawbacks of lifetime agreements for SaaS products in more detail:</p><h3><strong>Pros:</strong></h3><p>Increased revenue: The possibility of a big rise in revenue is one of the key advantages of providing lifetime packages. A lifetime deal can result in a significant cash infusion up front, which you can utilise to develop and enhance your product further.</p><p>Client loyalty: By providing a lifetime bargain, you demonstrate to your clients that you care about their success and are eager to provide them with a wonderful deal. Customers may become more devoted to your brand as a result and choose to use it over time.</p><p>Referral marketing: Lifetime deals might also assist you in acquiring new clients through recommendation marketing. Because they have a vested stake in your product’s success, customers who have purchased lifetime deals are more likely to suggest it to others.</p><h3><strong>Cons:</strong></h3><p>Decreased revenue over time: A lifetime deal can initially enhance income significantly, but it can also cause revenue to decline over time. Customers will only pay once to gain access to your product, thus you won’t get ongoing income from them.</p><p>Costlier support: Providing lifetime packages may result in a rise in the price of support. Clients who purchase lifetime deals are more likely to need more help in the future because they might use your product for many more years.</p><p>Providing lifelong discounts might also reduce the perceived value of your goods. If customers can acquire a lifetime deal for a small portion of the price of a monthly subscription, they could think your product is less useful.</p><p>In conclusion, lifetime contracts for SaaS founders might be a double-edged sword. While they can significantly improve revenue and foster client loyalty, they may also have unintended consequences including dwindling revenue over time and rising support expenses. In the end, deciding whether to provide lifetime agreements should be based on a rigorous analysis of your business objectives and the potential influence on the long-term performance of your product.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=377aeacd656e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 Reasons why Freelancers & Small Businesses Need Time Tracking Tool]]></title>
            <link>https://medium.com/@ayarshabeer/4-reasons-why-freelancers-small-businesses-need-time-tracking-tool-b5e154e0bf5a?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5e154e0bf5a</guid>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[freelancers]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[time-tracking-software]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Mon, 31 Oct 2022 04:12:58 GMT</pubDate>
            <atom:updated>2022-10-31T04:12:58.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekoN9CjGqNmXZjVsZfyxvQ.jpeg" /></figure><blockquote>Ordinary people think merely of spending time; great people think of using it- <strong>Arthur Schopenhauer.</strong></blockquote><p>Freelancers or solopreneurs are often overwhelmed with the thought — how do I effectively manage my time when I have so many assignments to plough through?</p><p>There are only 1,440 minutes in a day. Are you productive to the best of your capability? Do you get the most from each day as you should? Every moment is precious. But often, you may not have enough clarity on how much time you spend on a particular project or client.</p><p>Your client will need proof of your time. But more than a client, you need to track idly spent time of you and your extended team, especially when working from home, to minimize distractions and beat procrastination. So whether you or your employees are scrolling Facebook, going down the endless rabbit hole of YouTube, TikTok or bingeing with Netflix, Prime, or Hulu, time-tracking tools like <a href="https://tack.one/">tack</a> helps you stick to your guns and enable you to manage your team, even remotely, on the go.</p><p>Check out the top four benefits of time tracking for you and your teams.</p><ol><li>Track your working hours: Know how many hours you or your team spend on completing a project so that you can create a correct invoice for your client. Are you working on a flat rate? No worries. Use the time tracker to know whether you are spending more time and money than initially scheduled to get over with a project. Whether personal or team productivity or streamlining your processes for much-desired clarity and insight, track your time to be on the top of your game.</li><li>Hassle-free project and team management: The initiation or operation of multiple projects need not be a bundle of contradictions between employees and clients. With time tracking by your side, you enable a line of sight for all stakeholders to keep everyone on the same page. You set expectations, your schedules look realistic, and your projects run on track. Post that, communication of progress is attained between co-workers (designers, developers, analysts, writers etc.) and clients. Everyone knows if progress towards the deadline is on course and a sense of urgency, direction, or motivation is in place. There is no last-minute rush or procrastination, and you meet the deadline on time every time.</li><li>Increase profitability, productivity and transparency: Since you know where your time, effort and resources are spent, with those valuable insights, you can reprioritize most and most minor profitable assignments and increase overall profitability by many folds. Because you can measure it, you can improve over it. The process helps you run your team at its peak efficiency. It also empowers you to use working hours more judiciously to produce better results in less time. Measuring self or employee productivity is easy as you can track factors like percentage of goal met (actual/goalX100), completion of several tasks, per employee revenue accrued, labour productivity (total output divided by total input), activity level etc. With transparent time-tracking software like <a href="https://tack.one/">tack</a>, resources involved with the projects can be transparent about their work and be accountable. Moreover, with an automatic reminder, everyone is clued in, which helps hassle-free management of activities for a smooth workflow.</li><li>Integration: Time-tracking solutions like <a href="https://tack.one/">tack</a> offers several integration options to connect automatically with your favourite project, CRM, accounting or payroll software. Allow project data to and from your desired apps so they can talk to each other for security, stability and ease of use and improve workflows and processes.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5e154e0bf5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install multiple Django version using virtualenvwrapper]]></title>
            <link>https://medium.com/@ayarshabeer/install-multiple-django-version-using-virtualenvwrapper-c76328089bbd?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c76328089bbd</guid>
            <category><![CDATA[virtualenv]]></category>
            <category><![CDATA[virtualenvwrapper]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Mon, 20 Jun 2016 16:28:28 GMT</pubDate>
            <atom:updated>2016-09-28T06:01:22.716Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi guys, Are you finding difficulties to install multiple django version and switch between them easily? Here is the way.</p><p>We can achieve this by using virtualenv and virtualenvwrapper. virtualenv allows you to set up multiple isolated Python environments and virtualenvwrapper allows create and manage multiple virtualenv seamlessly.</p><p>Here is the simple steps to setup</p><p>1) Install virtualenv and virtualenvwrapper</p><pre><strong><em>sudo pip install virtualenv virtualenvwrapper</em></strong></pre><p>2) Create virtual env directory, all your environment files will be under this directory.</p><pre><strong>mkdir ~/.virtualenvs</strong></pre><p>3) Set enviromental path in .bashrc file (ubuntu)</p><p><strong>vi .bashrc</strong>, add below lines to end of the file.</p><pre><em>export WORKON_HOME=$HOME/.virtualenvs</em><br><em>source /usr/local/bin/virtualenvwrapper.sh</em></pre><p>For mac it will be<strong> .profile</strong> file</p><p>4) Close your terminal and open new one. Execute following command to create virtual environment</p><pre>mkvirtualenv env1</pre><p>After the above step you see the terminal something like, terminal starting with enclosed string “env1”.</p><pre>(env1)$</pre><p>Your virutual enviroment created andd i ready. Now you can install your Django version under env1,</p><p>5) Install Django 1.9</p><pre>(env1)$ pip install django==1.9</pre><p>Above step will install django 1.9 under virtual enviroment env1, and you can access it only by virtual environment <strong>env1</strong>.</p><p>6) If you want work on django 1.7, create another virtual enviroment</p><pre><strong>mkvirtualenv env2</strong></pre><p>after this command your terminal promt will be like this</p><pre><em>(env2)</em>$</pre><p>7) Install Django 1.7</p><pre><em>(env2)</em>$pip install django==1.7</pre><p>8) If you want to switch to env1 , run below command</p><pre>(env2)$ workon env1</pre><p>will result the current environment to <strong>env1</strong>,</p><pre><em>(env1)</em>$</pre><p>Using <strong>workon</strong> command you can easily switch between environments.</p><p>Now you have totally two different python environment and you can install any packanges in these environments without any conflict.</p><p>Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c76328089bbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django Best Practice: Settings file for multiple environments]]></title>
            <link>https://medium.com/@ayarshabeer/django-best-practice-settings-file-for-multiple-environments-6d71c6966ee2?source=rss-7e65ad994d2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d71c6966ee2</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Shabeer Ayar]]></dc:creator>
            <pubDate>Mon, 14 Mar 2016 15:27:51 GMT</pubDate>
            <atom:updated>2018-09-13T01:54:09.312Z</atom:updated>
            <content:encoded><![CDATA[<p>When developing a django application you must have solved the problem of managing separate configuration for different environments like development, testing, staging, production etc. I was using django from v0.96, Django doesn’t have any standard approach to handle multiple settings. When I am starting new django project , I want to make sure my application should,</p><ul><li>Allow me to manage any number of environments without any hassle.</li><li>Secure all sensitive data, don’t track them in version system.</li><li>Avoid duplicate code by keeping common settings.</li><li>Support one click test &amp; deploy to any environments</li></ul><p>There are several ways to meet above requirements, however my favorite one is having settings module.</p><h4><strong>Create Settings module</strong></h4><p>Once you create django project, remove settings.py and create a folder called settings, here you can maintain enviroment specific files, so your project structure will be look like this,</p><pre>mysite/</pre><pre>├── manage.py</pre><pre>└── mysite</pre><pre>  ├── __init__.py</pre><pre>  ├── settings</pre><pre>  │ ├── __init__.py</pre><pre>  │ ├── base.py</pre><pre>  │ ├── local.py</pre><pre>  │ ├── production.py</pre><pre>  │ ├── staging.py</pre><pre>  │ └── testing.py</pre><pre>  ├── urls.py</pre><pre>  └── wsgi.py</pre><p><em>base.py</em> will contain all of our common settings between all environments, import this file to all other environment file, e.g.: <em>local.py</em> will look like</p><pre>from .base import *</pre><pre>INSTALLED_APPS += (<br>        &#39;debug_toolbar&#39;,<br>    )</pre><p>As we have settings file for each environment, we can easily manage environment specific settings into respective files.</p><h4><strong>Read configuration from json file</strong></h4><p>Many developers recommends read from environment variable, but I always have multiple projects in my system and it may conflict.I prefer read from configuration file like xml, config , yaml or json. I chosen json because it can be used for non-python application as well. Create json file <em>mysite_config.json</em> like</p><pre>{<br>    &quot;SECRET_KEY&quot; : &quot;My secret key here&quot;,<br>    &quot;DATABASE_URL&quot; : &quot;postgres://user:pwd@localhost:5432/mysitedb&quot;,<br>    &quot;DEBUG&quot; : &quot;True&quot;</pre><pre>}</pre><p>The <em>mysite_config.json </em>file should be untracked from the version control system(you can track local config file for team collaboration),<em> </em>set file location in environment variable as,</p><pre>export MYSITE_CONFIG=&quot;/Users/shabeer/.configs/mysite_config.json&quot;</pre><p>you can set configuration in <em>base.py</em> using below code</p><pre>import os<br>import json</pre><pre>from django.core.exceptions import ImproperlyConfigured</pre><pre>with open(os.environ.get(&#39;MYSITE_CONFIG&#39;)) as f:<br> configs = json.loads(f.read())</pre><pre>def get_env_var(setting, configs=configs):<br> try:<br>     val = configs[setting]<br>     if val == &#39;True&#39;:<br>         val = True<br>     elif val == &#39;False&#39;:<br>         val = False<br>     return val<br> except KeyError:<br>     error_msg = &quot;ImproperlyConfigured: Set {0} environment      variable&quot;.format(setting)<br>     raise ImproperlyConfigured(error_msg)</pre><pre>#get secret key<br>SECRET_KEY = get_env_var(&quot;SECRET_KEY&quot;)</pre><h4><strong>Execute management command</strong></h4><p>As we are not using django default settings module, it is important to specify settings file while executing any management module (runserver , syncdb etc),</p><pre>python manage.py runserver --settings=mysite.settings.local</pre><p>OR you can set DJANGO_SETTINGS_MODULE as environment variable</p><pre>export DJANGO_SETTINGS_MODULE=mysite.settings.local</pre><p>Now you can manage any enviroments, all your application code will tracked in version control, only thing you need mange is to create configuration file(e.g.:<em>mysite_config.json</em>) for each environment.</p><p>You can use similar approach for your package management file <strong>requirements.txt</strong>.</p><p>This working model for my projects, if anyone encounter a problem with this approach, we can discuss the same and update it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d71c6966ee2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>