<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jake Malachowski</title>
    <description>The latest articles on Forem by Jake Malachowski (@jakemalachowski).</description>
    <link>https://forem.com/jakemalachowski</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F434377%2Fc3b4caac-a9be-4098-920c-dedfdb641ae0.jpg</url>
      <title>Forem: Jake Malachowski</title>
      <link>https://forem.com/jakemalachowski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jakemalachowski"/>
    <language>en</language>
    <item>
      <title>How to Build an Anycast Network</title>
      <dc:creator>Jake Malachowski</dc:creator>
      <pubDate>Mon, 25 Oct 2021 20:54:28 +0000</pubDate>
      <link>https://forem.com/render/how-to-build-an-anycast-network-5bbl</link>
      <guid>https://forem.com/render/how-to-build-an-anycast-network-5bbl</guid>
      <description>&lt;p&gt;When you type a URL into your address bar, your browser performs a DNS lookup to resolve the human-readable domain name to an IP address necessary for networking software, for example &lt;code&gt;216.24.57.1&lt;/code&gt;. Armed with that IP, how do the packets comprising the request actually get from your local machine to a server somewhere in the world capable of handling that request? How do you ensure those packets route to the server that can handle the request most efficiently?&lt;/p&gt;

&lt;p&gt;Serving traffic as efficiently as possible, regardless of where it originates, is a critical requirement at Render. One answer to this challenge is to deploy a global fleet of servers to create an anycast network. What is an anycast network? What is it good for? How can you build your own? This post will answer all of these questions, but we’ll first need some background on the building blocks of global networking.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Brief Overview of the Internet
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fswil0t3vv0wm6w4wtarx.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fswil0t3vv0wm6w4wtarx.jpeg" alt="A diagram describing how an HTTP request is routed between autonomous systems to its destination via BGP" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
    The path that an HTTP request takes between autonomous systems communicating via BGP.&lt;br&gt;&lt;br&gt;
  
  &lt;/p&gt;

&lt;p&gt;The Internet is the greatest decentralized network in the history of mankind. There is no central authority that controls who is allowed to connect or how you can use it. How do we manage billions of internet-connected devices without any single organization in charge of maintaining the system? This is accomplished through the coordination of many independent entities called Autonomous Systems (AS). ASs are the networking backbone of the internet. These entities, often managed by ISPs or large technology organizations, are responsible for handling traffic for the IP addresses they manage and advertising the paths to all other IP prefixes of which they are aware. Connections between ASs, also known as peers, are established through the manual configuration of connections between routers.&lt;/p&gt;

&lt;p&gt;Once a connection has been established, ASs use the Border Gateway Protocol (BGP) to coordinate with each other. BGP carries the information necessary for ASs to determine the optimal path to a target. Many factors can be used to define "optimal", but the most common heuristic used is choosing the path with the fewest number of "hops" between ASs before reaching the destination. Each AS will store the best path for all IP prefixes in its routing table. When a route is added or removed, the AS will update its routing table, if necessary, and advertise the change to its peers so they can do the same. Each peer sends keep-alive messages to each other at regular intervals. If an AS does not send a keep-alive message before the configured timeout, the peer will stop advertising the AS as a reachable hop and packets will use a different path to reach the target if it exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Anycast?
&lt;/h2&gt;

&lt;p&gt;An anycast network is two or more servers advertising the same IP address from different locations. Why would we want to do this?&lt;/p&gt;

&lt;p&gt;Serving traffic from a single location often lacks the redundancy required for critical or latency-sensitive applications that serve users around the world. In the worst case of a global round-trip request, you can expect &lt;a href="https://hpbn.co/primer-on-latency-and-bandwidth/" rel="noopener noreferrer"&gt;300 ms of latency&lt;/a&gt; just in transit time. This doesn't account for the time it takes the server to process the request. Chain a few of these requests together and you're looking at a very sluggish application and a frustrating user experience. For applications that require high availability and low latency, you will want an architecture that has the following characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Globally distributed&lt;/li&gt;
&lt;li&gt;Automatically routes traffic to the optimal server&lt;/li&gt;
&lt;li&gt;Tolerates failures of individual servers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can leverage the advanced routing capabilities of BGP to create a fault-tolerant, low-latency system by building an anycast network. By advertising an IP from many servers around the world, we can rely on BGP to route users' requests to the nearest Point of Presence (PoP) -- or server, in other words -- that advertises the IP. When one of those PoPs fails, it will stop sending keep-alive messages to its peers, connected ASs will stop advertising the path, and traffic will reroute to a healthy PoP.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Render Uses Anycast
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmg2ue5vgcbqwvwlgx1x.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmg2ue5vgcbqwvwlgx1x.jpeg" alt="A diagram describing how Render uses anycast to route traffic to the proper origin" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
    How Render uses anycast to route traffic to the proper origin&lt;br&gt;&lt;br&gt;
  
  &lt;/p&gt;

&lt;p&gt;When you deploy a web service or static site on Render, you always get a subdomain of &lt;code&gt;onrender.com&lt;/code&gt; that makes your service accessible from the internet. In many cases, users want to use a custom domain that they own instead of an &lt;code&gt;onrender.com&lt;/code&gt; subdomain. Users can create a DNS &lt;code&gt;A&lt;/code&gt; record for their custom domain that points to an IP address provided by Render.&lt;/p&gt;

&lt;p&gt;Render strives to create the most delightful developer experience possible. One way we do this is by making it as simple as possible to configure your DNS settings for custom domains. We provide a single IP address (our anycast IP address) to use in your DNS settings. When a request reaches one of the servers advertising that IP, we will forward it to one of possibly several origins around the world, depending on where your site is hosted and whether it's a web service or a static site.&lt;/p&gt;

&lt;p&gt;We can't make any assumptions about where traffic will originate, and we can minimize latency by routing requests to the server closest to the end-user that's capable of responding to the request. For web services, the request always needs to go to the origin server--the server you've deployed to. But for static sites, we can rely on BGP to route requests to the server closest to the end-user; we advertise our IP from anycast servers worldwide, which inspect each request and forward it to a server capable of responding. So, the server that serves a request is one of hundreds of geographically distributed CDN edge servers containing a cached copy of your static site. If one of those servers fails, its peers will stop advertising the route and the traffic will be sent elsewhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building an Anycast Network
&lt;/h2&gt;

&lt;p&gt;Now that we understand the components that make up an anycast network, as well as the use cases for it, we're ready to dive into how you can build your own. At a high level, the steps for setting up anycast are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Obtain an Autonomous System Number&lt;/li&gt;
&lt;li&gt;Acquire an IP Address&lt;/li&gt;
&lt;li&gt;Find a Hosting Provider&lt;/li&gt;
&lt;li&gt;Configure BGP&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Obtain an Autonomous System Number
&lt;/h3&gt;

&lt;p&gt;The first step for setting up an anycast network is getting an autonomous system number (ASN). An ASN is a unique identifier that other ASs will use when announcing a path to reach you via BGP. Having an ASN is also a prerequisite for acquiring an IP address. ASNs are managed by five &lt;a href="https://en.wikipedia.org/wiki/Regional_Internet_registry" rel="noopener noreferrer"&gt;Regional Internet Registries&lt;/a&gt;. As the name suggests, each registry is responsible for managing the ASNs within specific geographic regions of the world.&lt;/p&gt;

&lt;p&gt;Each registry has different requirements for acquiring an ASN. If you’re based in the United States, you'll work with &lt;a href="https://www.arin.net/" rel="noopener noreferrer"&gt;ARIN&lt;/a&gt; to get yours. Their process is straightforward. You just need to &lt;a href="https://www.arin.net/resources/guide/request/#asn" rel="noopener noreferrer"&gt;submit a request&lt;/a&gt; with some supporting documentation along with an explanation of why you need the ASN. ARIN grants ASNs to organizations for two purposes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Unique Routing Policy: Organizations who want to define routing policies that differ from their connected peers.&lt;/li&gt;
&lt;li&gt;Multi-homed: Organizations that will be peering with multiple providers. Multi-homing is usually done to improve coverage and resiliency to failures of individual providers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When Render applied for an ASN, we wanted the ability to advertise from multiple providers, so we used multi-homing as a justification for receiving an ASN. After submitting our application, ARIN responded with our ASN within a week.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqaha8ndrpaym2edi07p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqaha8ndrpaym2edi07p.png" alt="A screenshot showing a whois lookup for Render's ASN" width="800" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Acquire an IP Address
&lt;/h3&gt;

&lt;p&gt;Now that you have an ASN, you can acquire an IP block to advertise. The minimum &lt;a href="https://www.ripe.net/about-us/press-centre/understanding-ip-addressing" rel="noopener noreferrer"&gt;IP prefix&lt;/a&gt; that can be advertised is a &lt;code&gt;/24&lt;/code&gt; for IPv4 and a &lt;code&gt;/48&lt;/code&gt; for IPv6. This limit exists to prevent the routing tables that ASs need to manage from growing too large.&lt;/p&gt;

&lt;p&gt;You are going to need to decide whether you want to buy or lease your IP block. The dynamics at play here are similar to buying and leasing most things. Buying an IP block comes with a large upfront cost, while leasing requires less capital at the start but you will be paying a fee for as long as you use the IP block. Leasing also comes with additional terms and conditions on how you can use the IP block. If you have the capital and intend to use the IP block for an extended period of time, it likely makes sense to buy. Almost all available IPv4 addresses have been allocated and demand for them continues to rise. You can expect the cost to obtain them to continue to grow until IPv6 adoption is widespread enough to justify dropping support for IPv4.&lt;/p&gt;

&lt;p&gt;Since we knew that we would need the IP block for the foreseeable future, we decided to buy one. Asking all of our users to update their DNS records would be extremely disruptive, so we wanted to ensure that our IP block would remain stable for as long as it was in use. We had a good experience using &lt;a href="https://ipv4.global/" rel="noopener noreferrer"&gt;IPv4 Global&lt;/a&gt; to purchase our IP block. The remainder of this post will assume that you have chosen to buy instead of lease.&lt;/p&gt;

&lt;p&gt;There are a couple of things you should verify before buying an IP block. The block needs to be registered with the Regional Internet Registry that you acquired your ASN from, or it must be transferable to them. You will also want to verify that the IP addresses in the block are in good standing. Some IP addresses have been used for nefarious purposes and end up on widely-used blocklists. There are many free &lt;a href="https://whatismyipaddress.com/blacklist-check" rel="noopener noreferrer"&gt;services&lt;/a&gt; available that will check an IP address against the most popular databases of bad IPs.&lt;/p&gt;

&lt;p&gt;Once you purchase your IP block, you will need to go through the process of transferring ownership from the previous holder of the IP block. The service you use to purchase the block will likely guide you through that process, which will involve working with your Regional Internet Registry to transfer ownership. The exact steps will depend on the registry and whether the block needs to be transferred between registries. You can look at &lt;a href="https://www.arin.net/resources/registry/transfers/" rel="noopener noreferrer"&gt;ARIN's documentation&lt;/a&gt; to get an idea of what's involved in the process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Find a Hosting Provider
&lt;/h3&gt;

&lt;p&gt;Now that we have an IP address to advertise, it's time to determine what providers we will use to advertise it. Not all providers support BGP, so you're going to want to find ones that have the capability. In our anycast network setup process, we decided to go with &lt;a href="https://www.vultr.com/" rel="noopener noreferrer"&gt;Vultr&lt;/a&gt; and &lt;a href="https://metal.equinix.com/" rel="noopener noreferrer"&gt;Equinix Metal&lt;/a&gt;.&lt;sup id="fnref1"&gt;1&lt;/sup&gt; The latter is a bare metal provider rather than a VPS provider, so you should verify whether that makes sense for your use case before deciding to go with them. We chose Vultr because they had global coverage, low cost, and thorough documentation on how to set up BGP. You can find discussions comparing VPS providers on forums like &lt;a href="https://www.lowendtalk.com/discussion/120476/vps-providers-with-bgp-sessions" rel="noopener noreferrer"&gt;LowEndTalk&lt;/a&gt; to determine what provider makes sense for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure BGP
&lt;/h3&gt;

&lt;p&gt;The next step is to set up your server and start accepting traffic for your anycast IP address. After getting your application running on the server, you can get started on configuring BGP.&lt;/p&gt;

&lt;p&gt;When we configured BGP, we first needed to submit an application to Vultr requesting that they enable BGP for our account. They had us send a &lt;a href="https://www.vultr.com/docs/example-letter-of-authorization-for-bgp-announcements" rel="noopener noreferrer"&gt;Letter of Authorization&lt;/a&gt; that allowed them to advertise our IP address from their platform. As a part of this process, Vultr created a record in the &lt;a href="https://www.arin.net/resources/manage/irr/" rel="noopener noreferrer"&gt;Internet Routing Registry&lt;/a&gt; on our behalf that signals to the rest of the internet how to handle traffic for our IP. It's a great UX to have Vultr take care of this for you. However, it’s important to note that Vultr will delete this record if you end up migrating away from them. You must create a new record before they delete their copy to avoid any service disruptions.&lt;/p&gt;

&lt;p&gt;The next step is configuring BGP on your server. You're going to need to choose a BGP daemon to handle the advertisement. The two most common are &lt;a href="https://www.quagga.net/" rel="noopener noreferrer"&gt;Quagga&lt;/a&gt; and &lt;a href="https://bird.network.cz/" rel="noopener noreferrer"&gt;BIRD&lt;/a&gt;. We decided to use BIRD since Vultr recommended it and they have &lt;a href="https://www.vultr.com/docs/configuring-bgp-on-vultr" rel="noopener noreferrer"&gt;excellent documentation&lt;/a&gt; for getting it running.&lt;/p&gt;

&lt;p&gt;After installing BIRD, create a file called &lt;code&gt;/etc/bird.conf&lt;/code&gt; with the following contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;router id 203.0.113.123 # IP of the Vultr server running BIRD

protocol bgp vultr
{
    local as 123456; # your ASN
    source address 203.0.113.123;
    import none;
    export all;
    multihop 2;
    neighbor 169.254.169.254 as 64515; # Vultr’s peering information
    password "my-secret-password"; # BGP password provided by Vultr
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After restarting BIRD, your server will establish a peering session with Vultr’s AS. At this point, your server is capable of transmitting packets with the rest of the internet. Now you just need to tell the rest of the internet that you’re here! The final step is to announce your route. Append the following to the same &lt;code&gt;bird.conf&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protocol static
{
        route 123.4.567.890/24 via 203.0.113.123; # your IP via Vultr’s IP
}

protocol device
{
        scan time 5;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart BIRD again to load the new configuration. At this point, your BGP server is announcing the route to Vultr, who is in turn announcing the route to their peers (who then announce it to &lt;em&gt;their&lt;/em&gt; peers). The process continues until your new route propagates across the internet. Your server can now serve traffic for your IP! Repeat these same steps with a second server in another region and you have your very own anycast network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;While this post provides the information needed to get your anycast network running, you may still need to adjust your settings to fine-tune the traffic patterns for your network. As mentioned previously, ASs usually choose the path with the fewest number of hops to a destination. Fewer hops does not necessarily mean it will be faster if, for example, one of those hops crosses the Atlantic Ocean. If you notice suboptimal performance, you may want to look into changing the traffic patterns with tools like &lt;a href="https://www.noction.com/blog/understanding-bgp-communities" rel="noopener noreferrer"&gt;communities&lt;/a&gt; and &lt;a href="https://www.noction.com/blog/as-path-and-as-path-prepending" rel="noopener noreferrer"&gt;prepending&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Anycast networks are a powerful tool that leverages the networking infrastructure of the internet to create resilient and performant systems. I hope this post was insightful enough to add another tool to your toolbelt when building reliable systems.&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;We don't use Vultr or Equinix Metal anymore because of how our Anycast needs have evolved; we'll discuss our new setup in another blog post! ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>devops</category>
      <category>learning</category>
      <category>howto</category>
      <category>networking</category>
    </item>
    <item>
      <title>Deploying Your Rails 6 App</title>
      <dc:creator>Jake Malachowski</dc:creator>
      <pubDate>Fri, 24 Jul 2020 18:21:57 +0000</pubDate>
      <link>https://forem.com/render/deploying-your-rails-6-app-4an4</link>
      <guid>https://forem.com/render/deploying-your-rails-6-app-4an4</guid>
      <description>&lt;p&gt;This article was originally published at: &lt;a href="https://render.com/docs/deploy-rails" rel="noopener noreferrer"&gt;https://render.com/docs/deploy-rails&lt;/a&gt;. It's recommended to read the linked version with improved syntax highlighting.&lt;/p&gt;

&lt;p&gt;This guide will demonstrate how you can set up a local &lt;a href="https://rubyonrails.org/" rel="noopener noreferrer"&gt;Ruby on Rails 6&lt;/a&gt; environment, create a simple view, and deploy it to Render. The application will be configured to use a Render PostgreSQL &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;database&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The repository used for this demo can be found &lt;a href="https://github.com/render-examples/rails6" rel="noopener noreferrer"&gt;here&lt;/a&gt; and the sample app can be viewed &lt;a href="https://rails.onrender.com" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Ruby on Rails Project
&lt;/h2&gt;

&lt;p&gt;In this step, we will set up a local development environment with a basic project structure.&lt;/p&gt;

&lt;p&gt;We will be calling this example project &lt;code&gt;myrailssite&lt;/code&gt;. You can replace this with a name of your choosing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Rails
&lt;/h3&gt;

&lt;p&gt;To install Ruby on Rails on your machine, use the &lt;code&gt;gem install&lt;/code&gt; command. Be sure you have the &lt;a href="https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails" rel="noopener noreferrer"&gt;required dependencies&lt;/a&gt; installed (Ruby, Node.js and Yarn 1.x).&lt;br&gt;
We are using Rails 6 in this tutorial, so verify that you have the correct version installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gem install rails
$ rails --version
Rails 6.0.3.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a New Project
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In your terminal, navigate to the directory where you will be creating your project. Then, run the following commands to generate a new project:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;rails new myrailssite &lt;span class="nt"&gt;--database&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;postgresql
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;You can make use of arguments to customize the generated project. Enter &lt;code&gt;rails new -h&lt;/code&gt; for further details.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a local database for your application:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $ rails db:create
 Created database 'myrailssite_development'
 Created database 'myrailssite_test'
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
This should create a fully functional basis for you new Rails application! To verify, you can start the development server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;rails server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see your application in action, open a browser window and navigate to &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;. You should see the Rails default information page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2F3740a4bd446dae336ba55ee4bc71b390%2Fb2aca%2Fwelcome.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2F3740a4bd446dae336ba55ee4bc71b390%2Fb2aca%2Fwelcome.webp" alt="Rails Successful Installation" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create the Hello World Landing Page
&lt;/h2&gt;

&lt;p&gt;In this section, you will create a simple Rails application with a static view using Ruby on Rails. If you plan to deploy your sample Rails project on Render, skip to Update Your App For Render and deploy an empty project.&lt;/p&gt;

&lt;p&gt;Checkout the official  &lt;a href="https://guides.rubyonrails.org/getting_started.html" rel="noopener noreferrer"&gt;Getting Started with Rails&lt;/a&gt; guide for further reading on how to create Rails applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Your First Page
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In order to create a new Rails controller, you need to run the &lt;em&gt;controller generator&lt;/em&gt;. Set the controller's name to &lt;code&gt;Render&lt;/code&gt; and set up an action named &lt;code&gt;index&lt;/code&gt; using the following command:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;rails g controller Render index
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The generator will create several files in your project:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; create  app/controllers/render_controller.rb
  route  get 'render/index'
 invoke  erb
 create    app/views/render
 create    app/views/render/index.html.erb
 invoke  test_unit
 create    test/controllers/render_controller_test.rb
 invoke  helper
 create    app/helpers/render_helper.rb
 invoke    test_unit
 invoke  assets
 invoke    scss
 create      app/assets/stylesheets/render.scss
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2. Open the &lt;code&gt;config/routes.rb&lt;/code&gt; file and add the following line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rails.application.routes.draw do
 get 'render/index'

 # For more details on this file's DSL, see https://guides.rubyonrails.org/routing.html
 root 'render#index'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file will tell Rails that you want your &lt;code&gt;render/index&lt;/code&gt; action to be accessible from the root URL of your application.&lt;/p&gt;

&lt;p&gt;3. Open the &lt;code&gt;app/views/render/index.html.erb&lt;/code&gt; file and replace its contents with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;main class="container"&amp;gt;
  &amp;lt;div class="row text-center justify-content-center"&amp;gt;
    &amp;lt;div class="col"&amp;gt;
      &amp;lt;h1 class="display-4"&amp;gt;Hello World!&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/main&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add Third-Party CSS
&lt;/h3&gt;

&lt;p&gt;In this step you will integrate &lt;a href="https://getbootstrap.com/" rel="noopener noreferrer"&gt;Bootstrap&lt;/a&gt; into your application for easy styling.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In order to install Bootstrap, run the following command in your terminal:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;yarn add bootstrap
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Rename your &lt;code&gt;app/assets/stylesheets/application.css&lt;/code&gt; to &lt;code&gt;app/assets/stylesheets/application.scss&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open &lt;code&gt;app/assets/stylesheets/application.scss&lt;/code&gt; and replace its contents with:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; /*
  * This is a manifest file that'll be compiled into application.css, which will include all the files
  * listed below.
  *
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
  * vendor/assets/stylesheets directory can be referenced here using a relative path.
  */

 @import "bootstrap/scss/bootstrap";

 @import "**/*";
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So far, we imported Bootstrap into our CSS pack. This means Bootstrap will now be a part of the stylesheets served with our application.&lt;/p&gt;

&lt;p&gt;Then, we replaced the existing &lt;code&gt;require_*&lt;/code&gt; Rails directives with a plain SASS &lt;a href="https://sass-lang.com/documentation/at-rules/import" rel="noopener noreferrer"&gt;&lt;code&gt;@import&lt;/code&gt; rule&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Both methods import all stylesheets from the &lt;code&gt;app/assets/styleshets&lt;/code&gt; directory and its subdirectories. However, the use of the &lt;code&gt;@import&lt;/code&gt; rule allows the imported stylesheets to access the SASS variables defined by Bootstrap.&lt;/p&gt;

&lt;p&gt;4. Open &lt;code&gt;app/views/layouts/application.html.erb&lt;/code&gt; and add the following modifications to the heading:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="&amp;lt;%= I18n.locale %&amp;gt;"&amp;gt;
  &amp;lt;head&amp;gt;
   &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;

    &amp;lt;title&amp;gt;Hello Rails on Render!&amp;lt;/title&amp;gt;
    &amp;lt;%= csrf_meta_tags %&amp;gt;
    &amp;lt;%= csp_meta_tag %&amp;gt;

    &amp;lt;%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %&amp;gt;
    &amp;lt;%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %&amp;gt;
  &amp;lt;/head&amp;gt;
  ...
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add an Image Asset
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In order to add an asset to your project, download this banner and save it as &lt;code&gt;app/assets/images/render.png&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm06rnzebwnc0xmcdsiqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm06rnzebwnc0xmcdsiqj.png" alt="render.png" width="800" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2. In your layout, in &lt;code&gt;app/views/layouts/application.html.erb&lt;/code&gt;, reference the downloaded image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   ...
   &amp;lt;body&amp;gt;
      &amp;lt;header class="container mt-4 mb-4"&amp;gt;
        &amp;lt;a href="https://render.com"&amp;gt;
          &amp;lt;%= image_tag 'render.png', class: 'mw-100' %&amp;gt;
        &amp;lt;/a&amp;gt;
      &amp;lt;/header&amp;gt;
      &amp;lt;%= yield %&amp;gt;
   &amp;lt;/body&amp;gt;
   &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now verify that your app is working using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;rails server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2Fb5195e60f407c6baec116f98f60c27b0%2Fd3e6f%2Fhello-world.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2Fb5195e60f407c6baec116f98f60c27b0%2Fd3e6f%2Fhello-world.webp" alt="Rails Hello World" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Your App For Render
&lt;/h2&gt;

&lt;p&gt;In order for your Rails project to be ready for production, you will need to make a few adjustments. If you haven't already, you will be required update your project to use a &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;Render PostgreSQL database&lt;/a&gt;) instead of a SQLite database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Modify Existing Rails Project for PostgreSQL
&lt;/h3&gt;

&lt;p&gt;This is only required if the application was created without specifying &lt;code&gt;--database=postgresql&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In your &lt;code&gt;Gemfile&lt;/code&gt; change the requirement for the existing database driver:&lt;/p&gt;

&lt;p&gt;from:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt; &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'sqlite3'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;to:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt; &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'pg'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install your new dependencies using the following command. This will also update your &lt;code&gt;Gemfile.lock&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open &lt;code&gt;config/database.yml&lt;/code&gt; and update it to use the &lt;code&gt;postgresql&lt;/code&gt; database adapter.:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; # PostgreSQL. Versions 9.3 and up are supported.
 #
 # Install the pg driver:
 #   gem install pg
 # On macOS with Homebrew:
 #   gem install pg -- --with-pg-config=/usr/local/bin/pg_config
 # On macOS with MacPorts:
 #   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
 # On Windows:
 #   gem install pg
 #       Choose the win32 build.
 #       Install PostgreSQL and put its /bin directory on your path.
 #
 # Configure Using Gemfile
 # gem 'pg'
 #
 default: &amp;amp;default
   adapter: postgresql
   encoding: unicode
   # For details on connection pooling, see Rails configuration guide
   # https://guides.rubyonrails.org/configuring.html#database-pooling
   pool: &amp;lt;%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %&amp;gt;

 development:
   &amp;lt;&amp;lt;: *default
   database: myrailssite_development

   # The specified database role being used to connect to postgres.
   # To create additional roles in postgres see `$ createuser --help`.
   # When left blank, postgres will use the default role. This is
   # the same name as the operating system user that initialized the database.
   #username: myrailssite

   # The password associated with the postgres role (username).
   #password:

   # Connect on a TCP socket. Omitted by default since the client uses a
   # domain socket that doesn't need configuration. Windows does not have
   # domain sockets, so uncomment these lines.
   #host: localhost

   # The TCP port the server listens on. Defaults to 5432.
   # If your server runs on a different port number, change accordingly.
   #port: 5432

   # Schema search path. The server defaults to $user,public
   #schema_search_path: myapp,sharedapp,public

   # Minimum log levels, in increasing order:
   #   debug5, debug4, debug3, debug2, debug1,
   #   log, notice, warning, error, fatal, and panic
   # Defaults to warning.
   #min_messages: notice

 # Warning: The database defined as "test" will be erased and
 # re-generated from your development database when you run "rake".
 # Do not set this db to the same as development or production.
 test:
   &amp;lt;&amp;lt;: *default
   database: myrailssite_test

 # As with config/credentials.yml, you never want to store sensitive information,
 # like your database password, in your source code. If your source code is
 # ever seen by anyone, they now have access to your database.
 #
 # Instead, provide the password as a unix environment variable when you boot
 # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
 # for a full rundown on how to provide these environment variables in a
 # production deployment.
 #
 # On Heroku and other platform providers, you may have a full connection URL
 # available as an environment variable. For example:
 #
 #   DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
 #
 # You can use this database configuration with:
 #
 #   production:
 #     url: &amp;lt;%= ENV['DATABASE_URL'] %&amp;gt;
 #
 production:
   &amp;lt;&amp;lt;: *default
   database: myrailssite_production
   username: myrailssite
   password: &amp;lt;%= ENV['MYRAILSSITE_DATABASE_PASSWORD'] %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Go Production-Ready
&lt;/h3&gt;

&lt;p&gt;Before deploying any serious application in production, some minor tweaks are required.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;code&gt;config/database.yml&lt;/code&gt; and find the &lt;code&gt;production&lt;/code&gt; section. Modify it to gather the database configuration from the &lt;code&gt;DATABASE_URL&lt;/code&gt; environment variable:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;production&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;*default&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;%= ENV['DATABASE_URL'] %&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Open &lt;code&gt;config/puma.rb&lt;/code&gt; and uncomment and add the highlighted lines:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; # Puma can serve each request in a thread from an internal thread pool.
 # The `threads` method setting takes two numbers: a minimum and maximum.
 # Any libraries that use thread pools should be configured to match
 # the maximum value specified for Puma. Default is set to 5 threads for minimum
 # and maximum; this matches the default thread size of Active Record.
 #
 max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
 min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
 threads min_threads_count, max_threads_count

 # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
 #
 port        ENV.fetch("PORT") { 3000 }

 # Specifies the `environment` that Puma will run in.
 #
 environment ENV.fetch("RAILS_ENV") { "development" }

 # Specifies the `pidfile` that Puma will use.
 pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

 # Specifies the number of `workers` to boot in clustered mode.
 # Workers are forked web server processes. If using threads and workers together
 # the concurrency of the application would be max `threads` * `workers`.
 # Workers do not work on JRuby or Windows (both of which do not support
 # processes).
 #
 workers ENV.fetch("WEB_CONCURRENCY") { 4 }

 # Use the `preload_app!` method when specifying a `workers` number.
 # This directive tells Puma to first boot the application and load code
 # before forking the application. This takes advantage of Copy On Write
 # process behavior so workers use less memory.
 #
 preload_app!

 # Allow puma to be restarted by `rails restart` command.
 plugin :tmp_restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3. Open &lt;code&gt;config/environments/production.rb&lt;/code&gt; and enable the public file server when the &lt;code&gt;RENDER&lt;/code&gt; environment variable is present (which &lt;a href="https://render.com/docs/environment-variables" rel="noopener noreferrer"&gt;always is&lt;/a&gt; on Render):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; # Disable serving static files from the `/public` folder by default since
 # Apache or NGINX already handles this.
 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? || ENV['RENDER'].present?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Create a Build Script
&lt;/h3&gt;

&lt;p&gt;You will need to run a series of commands to build your app. This can be done using a build script. Create a script called &lt;code&gt;bin/render-build.sh&lt;/code&gt; at the root of your repository:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="c"&gt;# exit on error&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; errexit

bundle &lt;span class="nb"&gt;install
&lt;/span&gt;bundle &lt;span class="nb"&gt;exec &lt;/span&gt;rake assets:precompile
bundle &lt;span class="nb"&gt;exec &lt;/span&gt;rake assets:clean
bundle &lt;span class="nb"&gt;exec &lt;/span&gt;rake db:migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure the script is executable before checking it into Git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x bin/render-build.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will configure Render to call this script on every push to the Git repository.&lt;/p&gt;

&lt;p&gt;Commit all changes and push them to your GitHub repository. Now your application is ready to be deployed on Render!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy to Render
&lt;/h2&gt;

&lt;p&gt;There are two ways to deploy your application on Render, either by &lt;a href="https://render.com/docs/infrastructure-as-code" rel="noopener noreferrer"&gt;declaring your services within your repository&lt;/a&gt; in a &lt;code&gt;render.yaml&lt;/code&gt; file, or by manually setting up your services using the dashboard. In the following steps, we will walk you through both options.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use &lt;code&gt;render.yaml&lt;/code&gt; to Deploy
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a file named &lt;code&gt;render.yaml&lt;/code&gt; at the root of your directory with the following content. The file will include information about your Rails &lt;strong&gt;Web Service&lt;/strong&gt; and the &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/a&gt; that is used by your application. Don't forget to commit and push it to your remote repository.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;databases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myrailssite&lt;/span&gt;
        &lt;span class="na"&gt;databaseName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myrailssite&lt;/span&gt;
        &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myrailssite&lt;/span&gt;

   &lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;web&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myrailssite&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ruby&lt;/span&gt;
        &lt;span class="na"&gt;buildCommand&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./bin/render-build.sh"&lt;/span&gt;
        &lt;span class="na"&gt;startCommand&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bundle&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;exec&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;puma&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-C&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;config/puma.rb"&lt;/span&gt;
        &lt;span class="na"&gt;envVars&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DATABASE_URL&lt;/span&gt;
            &lt;span class="na"&gt;fromDatabase&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myrailssite&lt;/span&gt;
              &lt;span class="na"&gt;property&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;connectionString&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RAILS_MASTER_KEY&lt;/span&gt;
            &lt;span class="na"&gt;sync&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. On the Render Dashboard, go to the &lt;a href="https://dashboard.render.com/iacs" rel="noopener noreferrer"&gt;YAML&lt;/a&gt; page and click the &lt;code&gt;New From YAML&lt;/code&gt; button. Select your repository (after giving Render the permission to access it, if you haven't already).&lt;/p&gt;

&lt;p&gt;3. In the deploy window, set the value of the &lt;code&gt;RAILS_MASTER_KEY&lt;/code&gt; to the contents of your &lt;code&gt;config/master.key&lt;/code&gt; file. Then click &lt;code&gt;Approve&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That's it! Your app will be live on your &lt;code&gt;.onrender.com&lt;/code&gt; URL as soon as the build finishes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy Manually
&lt;/h3&gt;

&lt;p&gt;If you don't wish to deploy your Rails app through YAML deploys, you can follow these steps for a manual deploy.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a new &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;PostgreSQL database&lt;/a&gt; on Render. Note your database &lt;strong&gt;internal connection string&lt;/strong&gt;; you will need it later.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new &lt;strong&gt;Web Service&lt;/strong&gt;, pointing it to your application repository (make sure Render has a permission to access it).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;code&gt;Ruby&lt;/code&gt; for the environment and set the following properties:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Build Command&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;./bin/render-build.sh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Start Command&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bundle exec puma -C config/puma.rb&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;4. Add the following environment variables under the &lt;strong&gt;Advanced&lt;/strong&gt; section:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DATABASE_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The &lt;strong&gt;internal connection string&lt;/strong&gt; for the database you created above&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RAILS_MASTER_KEY&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Paste contents of the &lt;code&gt;config/master.key&lt;/code&gt; file&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's it! You can now finalize your service deployment. It will be live on your &lt;code&gt;.onrender.com&lt;/code&gt; URL as soon as the build finishes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Notes
&lt;/h2&gt;

&lt;p&gt;By default, Render uses the latest LTS version of Ruby. You can also modify the version of Ruby used by specifying it in &lt;code&gt;.ruby-version&lt;/code&gt; at the root of your project, or in your &lt;code&gt;Gemfile&lt;/code&gt; like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;ruby&lt;/span&gt; &lt;span class="s1"&gt;'2.7.1'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>rails</category>
      <category>ruby</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Deploying your Django 3 App</title>
      <dc:creator>Jake Malachowski</dc:creator>
      <pubDate>Mon, 20 Jul 2020 18:48:41 +0000</pubDate>
      <link>https://forem.com/render/deploying-your-django-3-app-239a</link>
      <guid>https://forem.com/render/deploying-your-django-3-app-239a</guid>
      <description>&lt;p&gt;This article was originally published at: &lt;a href="https://render.com/docs/deploy-django" rel="noopener noreferrer"&gt;https://render.com/docs/deploy-django&lt;/a&gt;. It's recommended to read the linked version with improved syntax highlighting.&lt;/p&gt;

&lt;p&gt;This guide will demonstrate how you can set up a local &lt;a href="https://www.djangoproject.com/" rel="noopener noreferrer"&gt;Django&lt;/a&gt; development environment, create a simple view, and deploy it to &lt;a href="https://render.com/" rel="noopener noreferrer"&gt;Render&lt;/a&gt;. The application will be configured to use a Render PostgreSQL &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;database&lt;/a&gt; and will use &lt;a href="https://python-poetry.org/" rel="noopener noreferrer"&gt;Poetry&lt;/a&gt; to manage the Python virtual environment and project dependencies, though neither are requirements to deploy a Django project on Render.&lt;/p&gt;

&lt;p&gt;The finished code for this example is available on &lt;a href="https://github.com/render-examples/django" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and the sample app can be viewed &lt;a href="https://mysite-gcqq.onrender.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This tutorial starts with a bare-bones installation and explains all required code modifications, so it should be straightforward to adapt it to any custom configuration in your existing Django codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Django Project
&lt;/h2&gt;

&lt;p&gt;In this step, we will set up a local development environment and create basic project structure.&lt;/p&gt;

&lt;p&gt;We will assume our project is called &lt;code&gt;mysite&lt;/code&gt; and consistently use it throughout the code. Feel free to choose a different name, though it must be a &lt;a href="https://www.python.org/dev/peps/pep-0008/#package-and-module-names" rel="noopener noreferrer"&gt;valid Python package name&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Poetry
&lt;/h3&gt;

&lt;p&gt;If you do not have Poetry installed, follow the Poetry &lt;a href="https://python-poetry.org/docs/#installation" rel="noopener noreferrer"&gt;installation instructions&lt;/a&gt; for your operating system. In most cases, you will simply need to run the following:&lt;/p&gt;

&lt;p&gt;macOS/Linux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-sSL&lt;/span&gt; https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Windows in PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Invoke-WebRequest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Uri&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-UseBasicParsing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Content&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You may need to restart your shell to load the &lt;code&gt;poetry&lt;/code&gt; command into your &lt;code&gt;PATH&lt;/code&gt;. To verify the installation was successful, try running &lt;code&gt;poetry --version&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Project Structure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;a href="https://python-poetry.org/docs/basic-usage/#project-setup" rel="noopener noreferrer"&gt;Poetry&lt;/a&gt; to initialize your project directory:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ poetry new mysite
   Created package mysite in mysite
   $ cd mysite
   $ ls
   README.rst     mysite         pyproject.toml tests

   # We don't need the code for our package that was generated by Poetry, so:
   $ rm -rf mysite tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;pyproject.toml&lt;/code&gt;, ensure the Python version requirement includes version &lt;code&gt;3.7&lt;/code&gt;, which is available on Render.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   [tool.poetry.dependencies]
   python = "^3.7"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add Django as a dependency.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nv"&gt;$ &lt;/span&gt;poetry add django
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a Django project for your application.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;poetry run django-admin startproject mysite &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should end up with the following directory structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;tree
   &lt;span class="nb"&gt;.&lt;/span&gt;
   ├── README.rst
   ├── manage.py
   ├── mysite
   │   ├── __init__.py
   │   ├── asgi.py
   │   ├── settings.py
   │   ├── urls.py
   │   └── wsgi.py
   ├── poetry.lock
   └── pyproject.toml

   1 directory, 9 files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, you should have a fully-functional scaffolding for your new Django application! To verify, you can start the development server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;poetry run ./manage.py runserver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2F4a76b00d1cb1412e04e54c2df0c5a671%2Fb2aca%2Fwelcome.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2F4a76b00d1cb1412e04e54c2df0c5a671%2Fb2aca%2Fwelcome.webp" alt="Django Successful Installation" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create the Hello World Landing Page
&lt;/h2&gt;

&lt;p&gt;In this section, you will create a simple Django application with a static view, template, and an example static file that showcases the basic steps in creating a page using Django. If you are only interested in learning how to deploy a sample Django project to Render, you can skip to the &lt;strong&gt;Update Your App For Render&lt;/strong&gt; section and deploy an empty project.&lt;/p&gt;

&lt;p&gt;If you wish to build something more complex, it's highly recommended to read the official &lt;a href="https://docs.djangoproject.com/en/3.0/intro/tutorial01/" rel="noopener noreferrer"&gt;Writing your first Django app&lt;/a&gt; guide.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the Render app
&lt;/h3&gt;

&lt;p&gt;Now that your application environment (a Django &lt;em&gt;project&lt;/em&gt;) is ready, you are ready to start working on the &lt;em&gt;application&lt;/em&gt; itself.&lt;/p&gt;

&lt;p&gt;Django &lt;em&gt;projects&lt;/em&gt; are collections of &lt;em&gt;applications&lt;/em&gt;, wired together to form a website. Django provides a number of built-in applications, with the &lt;a href="https://docs.djangoproject.com/en/3.0/ref/contrib/admin/" rel="noopener noreferrer"&gt;admin site&lt;/a&gt; being a well-known example.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To create your application, run the following command from the root directory of your project:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   python manage.py startapp render
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a directory named &lt;code&gt;render&lt;/code&gt; with following contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;tree render
   render
   ├── __init__.py
   ├── admin.py
   ├── apps.py
   ├── migrations
   │   ├── __init__.py
   ├── models.py
   ├── tests.py
   └── views.py

   1 directory, 7 files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You also need to inform Django about your new application. Open &lt;code&gt;mysite/settings.py&lt;/code&gt;, find definition of the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; setting, and add a reference to the &lt;code&gt;RenderConfig&lt;/code&gt; class at the beginning of the list:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # https://docs.djangoproject.com/en/3.0/ref/settings/#installed-apps
   INSTALLED_APPS = [
       'render.apps.RenderConfig',
       'django.contrib.admin',
       'django.contrib.auth',
       ...
   ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Write Your First View
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;render/views.py&lt;/code&gt; add the following Python code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.shortcuts&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;render&lt;/span&gt;

   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;render/index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is one of the simplest views possible in Django. It renders the &lt;code&gt;render/index.html&lt;/code&gt; template, which we will create in a later step.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create the &lt;code&gt;render/urls.py&lt;/code&gt; file and add following code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.urls&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;

   &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;views&lt;/span&gt;

   &lt;span class="n"&gt;urlpatterns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
       &lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;views&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
   &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file will tell Django that you want your &lt;code&gt;index&lt;/code&gt; view be accessible from the root URL of your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure the &lt;em&gt;root&lt;/em&gt; project &lt;code&gt;urlpatterns&lt;/code&gt; to point to the &lt;code&gt;urls&lt;/code&gt; module of the &lt;code&gt;render&lt;/code&gt; application. Open &lt;code&gt;mysite/urls.py&lt;/code&gt;, add an import for &lt;code&gt;django.urls.include&lt;/code&gt;, and &lt;code&gt;include&lt;/code&gt; your application's URLs:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   from django.contrib import admin
   from django.urls import path, include

   urlpatterns = [
       path('admin/', admin.site.urls),
       path('', include('render.urls')),
   ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create the &lt;code&gt;render/index.html&lt;/code&gt; template you referenced earlier. Create a new file &lt;code&gt;render/templates/render/index.html&lt;/code&gt; and add the following HTML:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   &amp;lt;!doctype html&amp;gt;
   &amp;lt;html lang="en"&amp;gt;
   &amp;lt;head&amp;gt;
       &amp;lt;meta charset="UTF-8"&amp;gt;
       &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
       &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;

       &amp;lt;title&amp;gt;Hello Django on Render!&amp;lt;/title&amp;gt;

       &amp;lt;link rel="stylesheet"
             href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
             integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
             crossorigin="anonymous"&amp;gt;
   &amp;lt;/head&amp;gt;
   &amp;lt;body&amp;gt;
   &amp;lt;main class="container"&amp;gt;
       &amp;lt;div class="row text-center justify-content-center"&amp;gt;
           &amp;lt;div class="col"&amp;gt;
               &amp;lt;h1 class="display-4"&amp;gt;Hello World!&amp;lt;/h1&amp;gt;
           &amp;lt;/div&amp;gt;
       &amp;lt;/div&amp;gt;
   &amp;lt;/main&amp;gt;
   &amp;lt;/body&amp;gt;
   &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add a static file to your application. Download this image and save it as &lt;code&gt;render/static/render/render.png&lt;/code&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm06rnzebwnc0xmcdsiqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm06rnzebwnc0xmcdsiqj.png" alt="render.png" width="800" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In your template, load the &lt;code&gt;static&lt;/code&gt; module and reference the downloaded image:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   {% load static %}

   &amp;lt;!doctype html&amp;gt;
   &amp;lt;html lang="en"&amp;gt;
   ...
   &amp;lt;body&amp;gt;
   &amp;lt;header class="container mt-4 mb-4"&amp;gt;
       &amp;lt;a href="https://render.com"&amp;gt;
           &amp;lt;img src="{% static "render/render.png" %}" alt="Render" class="mw-100"&amp;gt;
       &amp;lt;/a&amp;gt;
   &amp;lt;/header&amp;gt;
   ...
   &amp;lt;/body&amp;gt;
   &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You can now verify your app is working with the following command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;python manage.py runserver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2F8f9532444d55b4ad06d02fee9b2e8e65%2Fd63ad%2Fhello-world.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frender.com%2Fstatic%2F8f9532444d55b4ad06d02fee9b2e8e65%2Fd63ad%2Fhello-world.webp" alt="Django Hello World" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Your App For Render
&lt;/h2&gt;

&lt;p&gt;In order for your Django project to be ready for production, you will need to make a few adjustments in the application settings. You will update your project to use a &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;Render PostgreSQL database&lt;/a&gt; instead of a SQLite database and configure &lt;a href="http://whitenoise.evans.io/en/stable/django.html" rel="noopener noreferrer"&gt;WhiteNoise&lt;/a&gt; to serve your static files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go Production-Ready
&lt;/h3&gt;

&lt;p&gt;Before deploying any serious application onto production environment, you need to ensure it's properly secured and configured. Django documentation provides a useful &lt;a href="https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/" rel="noopener noreferrer"&gt;deployment checklist&lt;/a&gt;, which we will follow in this step.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;code&gt;mysite/settings.py&lt;/code&gt; and find the declaration of the &lt;code&gt;SECRET_KEY&lt;/code&gt; setting. We do not want to store production secrets in source code, so we'll fetch it from an environment variable that we'll create later:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # SECURITY WARNING: keep the secret key used in production secret!
   SECRET_KEY = os.environ.get('SECRET_KEY', default='your secret key')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Find the declaration of the &lt;code&gt;DEBUG&lt;/code&gt; setting. This setting should &lt;em&gt;never&lt;/em&gt; be set to &lt;code&gt;True&lt;/code&gt; in a production environment. You can detect if you are running on Render by checking if the &lt;code&gt;RENDER&lt;/code&gt; environment variable is present in the &lt;a href="https://render.com/docs/environment-variables" rel="noopener noreferrer"&gt;application environment&lt;/a&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # SECURITY WARNING: don't run with debug turned on in production!
   DEBUG = 'RENDER' not in os.environ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;When &lt;code&gt;DEBUG = False&lt;/code&gt;, Django will not work without a suitable value for &lt;code&gt;ALLOWED_HOSTS&lt;/code&gt;. You can get the name of your web service host from the &lt;code&gt;RENDER_EXTERNAL_HOSTNAME&lt;/code&gt; environment variable, which is automatically set by Render.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # https://docs.djangoproject.com/en/3.0/ref/settings/#allowed-hosts
   ALLOWED_HOSTS = []

   RENDER_EXTERNAL_HOSTNAME = os.environ.get('RENDER_EXTERNAL_HOSTNAME')
   if RENDER_EXTERNAL_HOSTNAME:
       ALLOWED_HOSTS.append(RENDER_EXTERNAL_HOSTNAME)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you add a custom domain to your Render app, don't forget to add your new domain to the list.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure Django for PostgreSQL
&lt;/h3&gt;

&lt;p&gt;For convenience, we will add the &lt;a href="https://github.com/jacobian/dj-database-url" rel="noopener noreferrer"&gt;DJ-Database-URL&lt;/a&gt; package, which allows us to specify databases in Django using connection strings. Render Databases automatically provide connection strings in their control panel, which we will then provide to our web service via the &lt;code&gt;DATABASE_URL&lt;/code&gt; environment variable. We will also need to add &lt;a href="https://www.psycopg.org/" rel="noopener noreferrer"&gt;psycopg2&lt;/a&gt; to the project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run following command to add necessary dependencies to your project:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;poetry add dj-database-url psycopg2-binary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;mysite/settings.py&lt;/code&gt;, find declaration of the &lt;code&gt;DATABASES&lt;/code&gt; setting and modify it to look as follows:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # Don't forget to import dj-database-url at the beginning of the file
   import dj_database_url
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # Database
   # https://docs.djangoproject.com/en/3.0/ref/settings/#databases

   DATABASES = {
       'default': dj_database_url.config(
           # Feel free to alter this value to suit your needs.
           default='postgresql://postgres:postgres@localhost:5432/mysite',
           conn_max_age=600
       )
   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Static Files
&lt;/h3&gt;

&lt;p&gt;Websites generally need to serve additional files such as images, JavaScript, and CSS. In Django, these files are referred to as &lt;a href="https://docs.djangoproject.com/en/3.0/howto/static-files/deployment/" rel="noopener noreferrer"&gt;static files&lt;/a&gt; and it provides a dedicated module for collecting them into single place for serving in production.&lt;/p&gt;

&lt;p&gt;The built-in module only supports moving files from one place to another, relying on web servers such as &lt;a href="https://httpd.apache.org/" rel="noopener noreferrer"&gt;Apache&lt;/a&gt; or &lt;a href="https://www.nginx.com/" rel="noopener noreferrer"&gt;NGINX&lt;/a&gt; to serve them to end users. On Render, the internet-facing web server is provided by default and we need a way to host static files using it. In this step, we will set up &lt;a href="http://whitenoise.evans.io" rel="noopener noreferrer"&gt;WhiteNoise&lt;/a&gt; which is a highly popular solution for this problem. The following instructions are a short brief of the procedure described in the &lt;a href="http://whitenoise.evans.io/en/stable/django.html" rel="noopener noreferrer"&gt;WhiteNoise documentation&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add WhiteNoise as a dependency (adding &lt;a href="https://en.wikipedia.org/wiki/Brotli" rel="noopener noreferrer"&gt;Brotli&lt;/a&gt; support is optional, but recommended):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   poetry add &lt;span class="s1"&gt;'whitenoise[brotli]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open &lt;code&gt;mysite/settings.py&lt;/code&gt;, find the &lt;code&gt;MIDDLEWARE&lt;/code&gt; list, and add the WhiteNoise middleware just after &lt;code&gt;SecurityMiddleware&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   MIDDLEWARE = [
       'django.middleware.security.SecurityMiddleware',
       'whitenoise.middleware.WhiteNoiseMiddleware',
       ...
   ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Find the section where static files are configured. Apply following modifications:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   # Static files (CSS, JavaScript, Images)
   # https://docs.djangoproject.com/en/3.0/howto/static-files/

   # This setting tells Django at which URL static files are going to be served to the user.
   # Here, they well be accessible at your-domain.onrender.com/static/...
   STATIC_URL = '/static/'

   # Following settings only make sense on production and may break development environments.
   if not DEBUG:
       # Tell Django to copy statics to the `staticfiles` directory
       # in your application directory on Render.
       STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

       # Turn on WhiteNoise storage backend that takes care of compressing static files
       # and creating unique names for each version so they can safely be cached forever.
       STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a Build Script
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;We need to run a series of commands to build our app. We can accomplish this with a build script. Create a script called &lt;code&gt;build.sh&lt;/code&gt; at the root of your repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
   &lt;span class="c"&gt;# exit on error&lt;/span&gt;
   &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; errexit

   poetry &lt;span class="nb"&gt;install

   &lt;/span&gt;python manage.py collectstatic &lt;span class="nt"&gt;--no-input&lt;/span&gt;
   python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure the script is executable before checking it into Git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;a+x build.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;We will configure Render to call this script on every push to the Git repository.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;We are going to run our application with &lt;a href="https://gunicorn.org/" rel="noopener noreferrer"&gt;Gunicorn&lt;/a&gt;. Add the dependency to your project:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   poetry add gunicorn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit all changes and push them to your GitHub repository. Now your application is ready to be deployed on Render!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy to Render
&lt;/h2&gt;

&lt;p&gt;There are two ways to deploy your application on Render, either by &lt;a href="https://render.com/docs/infrastructure-as-code" rel="noopener noreferrer"&gt;declaring your services within your repository&lt;/a&gt; using a &lt;code&gt;render.yaml&lt;/code&gt; file or by manually setting up your services using the dashboard. In this tutorial, we will walk through both options.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use &lt;code&gt;render.yaml&lt;/code&gt; for Deployments
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a file named &lt;code&gt;render.yaml&lt;/code&gt; in the root of your directory. The file will define your Django &lt;strong&gt;Web Service&lt;/strong&gt; and the &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/a&gt; used by your application. Don't forget to commit and push it to your remote repository.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;databases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysite&lt;/span&gt;
       &lt;span class="na"&gt;databaseName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysite&lt;/span&gt;
       &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysite&lt;/span&gt;

   &lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;web&lt;/span&gt;
       &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysite&lt;/span&gt;
       &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;python&lt;/span&gt;
       &lt;span class="na"&gt;buildCommand&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./build.sh"&lt;/span&gt;
       &lt;span class="na"&gt;startCommand&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gunicorn&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;mysite.wsgi:application"&lt;/span&gt;
       &lt;span class="na"&gt;envVars&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
         &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DATABASE_URL&lt;/span&gt;
           &lt;span class="na"&gt;fromDatabase&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
             &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysite&lt;/span&gt;
             &lt;span class="na"&gt;property&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;connectionString&lt;/span&gt;
         &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SECRET_KEY&lt;/span&gt;
           &lt;span class="na"&gt;generateValue&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
         &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;WEB_CONCURRENCY&lt;/span&gt;
           &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;On the Render Dashboard, go to the &lt;a href="https://dashboard.render.com/iacs" rel="noopener noreferrer"&gt;YAML&lt;/a&gt; page and click &lt;code&gt;New From YAML&lt;/code&gt; button. Select your application repository (give Render permission to access it if you haven't already) and click &lt;code&gt;Approve&lt;/code&gt; on the next screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it! Your app will be live on your &lt;code&gt;.onrender.com&lt;/code&gt; URL as soon as the build finishes.&lt;/p&gt;

&lt;p&gt;If you skipped the Create the Hello World Landing Page section, you will see a &lt;code&gt;Not Found&lt;/code&gt; error when visiting your site. You can verify your deploy was successful by visiting the admin dashboard at &lt;code&gt;/admin&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Manual Deployment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a new &lt;a href="https://render.com/docs/databases" rel="noopener noreferrer"&gt;PostgreSQL database&lt;/a&gt; on Render. Note your database &lt;strong&gt;internal connection string&lt;/strong&gt;; you will need it later.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new &lt;strong&gt;Web Service&lt;/strong&gt;, pointing it to your application repository (give Render permission to access it if you haven’t already).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;code&gt;Python&lt;/code&gt; for the environment and set following properties:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Build Command&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;./build.sh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Start Command&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gunicorn mysite.wsgi:application&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Add the following environment variables under &lt;strong&gt;Advanced&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DATABASE_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The &lt;strong&gt;internal connection string&lt;/strong&gt; for the database you created above&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SECRET_KEY&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Click &lt;code&gt;Generate&lt;/code&gt; to get a secure random value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WEB_CONCURRENCY&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's it! Save your web service to deploy your Django application on Render. It will be live on your &lt;code&gt;.onrender.com&lt;/code&gt; URL as soon as the build finishes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Django Admin Account
&lt;/h3&gt;

&lt;p&gt;Once your application is live, create a new &lt;a href="https://docs.djangoproject.com/en/3.0/intro/tutorial02/#creating-an-admin-user" rel="noopener noreferrer"&gt;Django admin account&lt;/a&gt; by running the following command in the Render Shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;./manage.py createsuperuser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>django</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
