<?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 CA on Medium]]></title>
        <description><![CDATA[Stories by CA on Medium]]></description>
        <link>https://medium.com/@cjarnold93?source=rss-d2494ec5d965------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uDoQRZk_i0rLDLvBdiMzVA.jpeg</url>
            <title>Stories by CA on Medium</title>
            <link>https://medium.com/@cjarnold93?source=rss-d2494ec5d965------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 08:53:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cjarnold93/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[Deploying Django with Deta Space]]></title>
            <link>https://medium.com/@cjarnold93/deploying-django-with-deta-space-a-minimalists-guide-327b2f6d6b15?source=rss-d2494ec5d965------2</link>
            <guid isPermaLink="false">https://medium.com/p/327b2f6d6b15</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[deta]]></category>
            <dc:creator><![CDATA[CA]]></dc:creator>
            <pubDate>Thu, 13 Jul 2023 19:25:44 GMT</pubDate>
            <atom:updated>2023-07-14T06:15:46.131Z</atom:updated>
            <content:encoded><![CDATA[<p>Deploying your Python based Django project with Deta Space can be done in less than 5 minutes!</p><p>In this guide, we will explore the process of deploying a Python-based Django project using Deta Space. This efficient deployment method can be completed effortlessly within a mere five minutes! While having some prior basic experience could prove beneficial, fear not, for it is not an absolute requirement. By the end of this guide, you will possess a fully functioning project that can be admired by individuals worldwide.</p><p>It is important to note that this guide focuses on minimalism and provides only the essential steps. However, please bear in mind that there are additional crucial steps that should be undertaken. For instance, you must consider the actual contents of your Django project (an obvious point) as well as implement some fundamental security settings. To delve into these topics in detail, refer to forthcoming articles that will be linked to this guide.</p><p>Now, without further ado, let us commence our journey!</p><h3>Step 1: The Setup</h3><p>If you haven’t already at this point;</p><ol><li>Register for a <a href="https://deta.space/">Deta Space</a> account and install the official <a href="https://deta.space/docs/en/build/fundamentals/space-cli/">Space CLI</a>.</li><li>To proceed, you must install both the ‘django’ and ‘uvicorn’ packages to your local envionrment using the ‘pip install’ command. This ensures that the required packages are in place for the successful deployment of your Django project.</li></ol><h3>Step 2: Create a New Django Project</h3><p>Now, it is time to create a fresh Django project folder along with the necessary files.</p><p>In this guide, our project will be named “django_space_app,” but feel free to choose any name that suits your preferences.</p><p>To initiate this process, open a terminal and navigate to the directory where you wish to establish your project. Execute the following command:</p><pre>django-admin startproject django_space_app</pre><p>Once the command completes, enter the newly created project folder’s root directory by running the command:</p><pre>cd django_space_app</pre><h3>Step 3: Initiate a Space Repository</h3><p>Once here, we want to set up a new space project. If this is your first time using the Space CLI, you will have to login: follow the prompts on the Space CLI documentation for <a href="https://deta.space/docs/en/build/fundamentals/space-cli/#authentication">authentication</a>.</p><p>Now, run the followig command to create the Space app:</p><pre>space new</pre><p>Then, add your projects name we used earlier:</p><pre>? What is your project&#39;s name? &gt; django_space_app</pre><p>And just like that, the Space App has been created!</p><h3>Step 4: Additional Space Settings and Project Files</h3><p>Before our fresh new Django App will deploy correctly, we want to add some files to our project.</p><h4>Space File</h4><p>1. Create a requirements.txt with the following contents in the root directory of the project folder:</p><pre>django<br>uvicorn</pre><p>2. In the Spacefile, we need to add the following settings:</p><pre># Spacefile Docs: https://go.deta.dev/docs/spacefile/v0<br>v: 0<br>micros:<br>  - name: space-analytics<br>    src: ./<br>    engine: python3.9<br>    primary: true<br>    run: uvicorn django_space_app.asgi:app<br>    dev: uvicorn django_space_app.asgi:app --reload<br>    public_routes:<br>      - &quot;/*&quot;</pre><p>We add the ‘ — reload’ option for the dev environment so when we make changes while developing, they will be directly used on refresh in our dev instances.</p><p>We have included the ‘-reload’ option for the development environment, which enables automatic application of any changes made during development upon refreshing the instances.</p><p>Upon completing these steps, your directory and file structure should resemble the following (excluding the ‘.space’ directory):</p><pre>my_django_app<br>└───my_django_app<br>      asgi.py<br>      settings.py<br>      urls.py<br>      __init__.py<br>      wsgi.py<br>SpaceFile<br>manage.py<br>requirements.txt</pre><p>Now, we are ready to push the Space App. In the terminal, execute the following command:</p><pre>space push</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*PwgLraUtodzX8XqVi11ZAQ.png" /><figcaption>After using ‘space push`.</figcaption></figure><p>After executing the ‘space push’ command, the build process will begin, and once completed, your app will be successfully deployed to Deta Space. However, it is important to note that the project will not yet run if you navigate to it. One final configuration step remains to be completed, as the project URL has been generated during the previous push.</p><p>Locate the builder instance URL in the terminal and copy it. Then, open the ‘settings.py’ file within your Django directory and add the copied URL to the ‘ALLOWED_HOSTS’ variable as follows:</p><pre>ALLOWED_HOSTS = [&#39;django_space_app-1-23asdba1.deta.app&#39;]</pre><h3>Last Steps — Run the App on Deta Space!</h3><p>Finally, utilize the ‘space push’ command to deploy the changes we have made.</p><p>At this stage, the project will be based on the files we created earlier, incorporating the settings we have defined thus far. If everything goes according to plan, you will be able to visit your project’s domain (in the form of ‘https://django_space_app-1–23asdba1.deta.app/&#39;) and witness the familiar Django initial debug screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*C_pUa8D6VbRQWTjQ.png" /></figure><p>Success!</p><p>You have successfully deployed, possibly your first, Django application using Deta Space.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=327b2f6d6b15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Minimalists Guide to Deploying Django with Heroku]]></title>
            <link>https://awstip.com/a-minimalists-guide-to-deploying-django-with-heroku-f8d0b7f521b7?source=rss-d2494ec5d965------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8d0b7f521b7</guid>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[app-development]]></category>
            <dc:creator><![CDATA[CA]]></dc:creator>
            <pubDate>Sun, 28 Aug 2022 08:06:04 GMT</pubDate>
            <atom:updated>2022-09-06T16:07:05.728Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying Django with Heroku: A Minimalists Guide</h3><p>Deploying your Python based Django project with Heroku can be done in less than 5 minutes! Some previous basic experience would be beneficial, but is not required. At the end of this guide you will have a functioning project that anyone in the world can appreciate.</p><p>Keep in mind: this is a minimalist guide! There are several additional steps which should be taken — for example: the actual contents of your django project (go figure), and some base security settings! These topics will be outlined in future articles and linked here.</p><h3>Let’s Get Started!</h3><p>If you haven’t already at this point;</p><ol><li><a href="https://www.heroku.com/">Register for your Heroku account </a>and install the <a href="https://devcenter.heroku.com/articles/heroku-cli">Heroku CLI</a> on your computer.</li><li>Install <a href="https://git-scm.com/download/win">Git </a>on your computer.</li><li>pip install django</li></ol><h4>Create A New Heroku Project</h4><p>Open up a command terminal and navigate to the folder you want your project to be stored. Run the following to login to Heroku.</p><pre>heroku login</pre><p>This will open a login prompt in your browser. Once logged in, return to the command terminal. We will now create our new Heroku project by running the below. The project name will be randomly generated.</p><pre>heroku create</pre><p>As an example, my randomly generated project name was “infinite-scrubland-12345”.</p><h4>Create a New Django Project</h4><p>Now, let’s create a blank Django project folder and files in the same directory. Our test project today is called “my_django_app” — use whatever project name you would like.</p><pre>django-admin startproject my_django_app</pre><p>Once done, <em>cd </em>into your new project folders root directory.</p><pre>cd my_django_app</pre><h4>Initiate a Git Repository</h4><p>Once here, we want to set up a new git repository and add our new files.</p><pre>git init<br>git add .</pre><p>We now want to link our new Git repository to the Heroku remote repository. You will find the Heroku remote repository link for your project when we created the Heroku project above. It will be in the form of:</p><blockquote>https://git.heroku.com/&lt;PROJECT_NAME&gt;.git</blockquote><pre>git remote add origin <a href="https://git.heroku.com/infinite-scrubland-12345.git">https://git.heroku.com/infinite-scrubland-12345.git</a></pre><p>With the Heroku remote repository now linked to our Git repository, we can commit our new files for the first time.</p><pre>git commit -m &quot;init commit&quot;</pre><h4>Additional Django and Heroku Files</h4><p>Before Heroku will deploy our App correctly, we want to add some files to our project.</p><ol><li>Let’s retrieve the standard python .gitignore from Github. <a href="https://github.com/github/gitignore/blob/main/Python.gitignore">https://github.com/github/gitignore/blob/main/Python.gitignore</a></li></ol><p>2. Create a requirements.txt with the following contents:</p><pre>Django~=4.1<br>gunicorn~=20.1</pre><p>3. Create a new file called “runtime.txt”. Heroku willuse this particuar Python version when running the project. Contents of the file are:</p><pre>python-3.9.13</pre><p>4. Create a new file called “Procfile”. This allows Heroku to know what to execute when it starts up. The contents should be:</p><pre>web: gunicorn portfolio_app.wsgi</pre><p>Now, add these new files into the root directory of the project. We should end up with a directory and file structure exactly as follows:</p><pre>my_django_app<br>│ .gitignore<br>│ manage.py<br>│ Procfile<br>│ requirements.txt<br>│ runtime.txt<br>└───my_django_app<br> asgi.py<br> settings.py<br> urls.py<br> wsgi.py<br> __init__.py</pre><h4>Updating Django And Heroku Settings</h4><p>Navigate to the settings.py file. First, add the “os” package as an import to the top of the file.</p><pre>import os</pre><p>Next, find the ALLOWED_HOSTS variable and add our project https link to it.</p><pre>ALLOWED_HOSTS = [&#39;infinite-scrubland-12345.herokuapp.com&#39;]</pre><p>We also need to add a new variable STATIC_ROOT to the file. You can add this near the pre-existing variable STATIC_URL.</p><pre>STATIC_ROOT = os.path.join(BASE_DIR, &#39;staticfiles&#39;)</pre><p>Now we need to generate a new SECRET_KEY variable. Go back to our command terminal and run the following to generate your secret key.</p><pre>python<br>import os<br>os.urandom(12).hex()<br>exit()</pre><p>Update the SECRET_KEY variable in settings.py with this new key. We can now upload this to the Heroku project.</p><pre>heroku config:set SECRET_KEY=theuniquesecretkeywejustgenerated -a infinite-scrubland-12345</pre><p>Finally, lets set the DEBUG to be True. This allows Django to run in debug mode.</p><pre>heroku config:set DEBUG=True -a infinite-scrubland-12345</pre><h4>Last Steps — Run the App!</h4><p>Finally, let’s commit our changes and push them to the Heroku remote repository.</p><pre>git add .<br>git commit -m &quot;init settings and configs&quot;<br>git push heroku</pre><p>At this point, Heroku will build the project based on the files we previously created and using the settings we defined so far. If all goes well, you will be able to navigate to your projects domain (in the form of <a href="https://infinite-scrubland-12345.herokuapp.com/)">https://infinite-scrubland-12345.herokuapp.com/)</a> and see the familiar Django initial debug screen!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*0R0LNtFbxmQ5HqBUsGLNMg.png" /><figcaption>Success!</figcaption></figure><p>I hope this article has been useful to get you started on your journey deploying Django applications using Heroku.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8d0b7f521b7" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/a-minimalists-guide-to-deploying-django-with-heroku-f8d0b7f521b7">A Minimalists Guide to Deploying Django with Heroku</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>