<?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>DEV Community: Elmer Urbina Meneses</title>
    <description>The latest articles on DEV Community by Elmer Urbina Meneses (@elmerurbina).</description>
    <link>https://dev.to/elmerurbina</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%2F1250971%2Fbb56c731-7151-467a-83a4-d313cfdab27a.jpg</url>
      <title>DEV Community: Elmer Urbina Meneses</title>
      <link>https://dev.to/elmerurbina</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elmerurbina"/>
    <language>en</language>
    <item>
      <title>Build a Smart Object Detection Alarm with Arduino &amp; HC-SR04 Sensor – Full Tutorial</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Thu, 13 Nov 2025 22:06:02 +0000</pubDate>
      <link>https://dev.to/elmerurbina/build-a-smart-object-detection-alarm-with-arduino-hc-sr04-sensor-full-tutorial-39da</link>
      <guid>https://dev.to/elmerurbina/build-a-smart-object-detection-alarm-with-arduino-hc-sr04-sensor-full-tutorial-39da</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this hands-on project, we successfully designed and built a smart object detection alarm using an &lt;strong&gt;Arduino UNO&lt;/strong&gt; and an &lt;strong&gt;HC-SR04 ultrasonic sensor&lt;/strong&gt;. The system detects objects within a predefined range and triggers an audible alert via a buzzer. This project not only demonstrates the use of ultrasonic technology for proximity sensing but also validates the functionality of new hardware components after troubleshooting earlier failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Objective:&lt;/strong&gt; Create a reliable object detection system using ultrasonic waves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Components:&lt;/strong&gt; Arduino UNO, HC-SR04 sensor, active/passive buzzer, and jumper wires.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Applications:&lt;/strong&gt; Parking assistance, home security, robotics, and   industrial measurement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Methodology &amp;amp; Components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We used an ultrasonic detection methodology combined with real-time audio feedback.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware Components:&lt;/strong&gt;&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%2Flp1ocvjb389kle3x4cfo.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%2Flp1ocvjb389kle3x4cfo.png" alt=" " width="594" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Circuit Diagram&lt;/strong&gt;&lt;br&gt;
Below is the wiring setup used in the project:&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%2F3mhq2br0jymo4tvtg6zj.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%2F3mhq2br0jymo4tvtg6zj.png" alt=" " width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arduino Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s the complete code uploaded to the Arduino IDE:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void setup() {
  // Define pin modes
  pinMode(trig, OUTPUT);
  pinMode(echo, INPUT);
  pinMode(buzzer, OUTPUT);
}

void loop() {
  long duration, distance;

  // Clear the trigger pin
  digitalWrite(trig, LOW);
  delayMicroseconds(2);

  // Send a 10µs pulse to trigger
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);

  // Read the echo pin and calculate pulse duration
  duration = pulseIn(echo, HIGH);

  // Calculate distance in cm
  distance = (duration / 2) * 0.0343;

  // If an object is detected within 10 cm, activate the buzzer
  if (distance &amp;lt; 10) {
    tone(buzzer, 4000); // Emit 4000 Hz tone
    delay(1000);
  } else {
    noTone(buzzer); // Turn off buzzer
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Key Functionalities Explained&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ultrasonic Detection:&lt;/strong&gt; The HC-SR04 emits an ultrasonic pulse and measures the time taken for the echo to return.&lt;/p&gt;

&lt;p&gt;Distance Calculation: Distance is calculated using the formula:&lt;/p&gt;

&lt;p&gt;Distance = (Duration / 2) * 0.0343&lt;br&gt;
where 0.0343 is the speed of sound in centimeters per microsecond.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alarm Trigger:&lt;/strong&gt; If an object is detected within 10 cm, the buzzer emits a 4000 Hz tone for 1 second.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Monitoring:&lt;/strong&gt; The system runs in a loop, providing real-time detection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parking Sensors:&lt;/strong&gt; Warn drivers of nearby obstacles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Home Security:&lt;/strong&gt; Detect intrusions near doors or windows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Robotics:&lt;/strong&gt; Enable obstacle avoidance in autonomous robots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Industrial Use:&lt;/strong&gt; Monitor fill levels in tanks or containers.&lt;/p&gt;

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

&lt;p&gt;This smart alarm system effectively demonstrates the use of ultrasonic sensors for object detection. It confirmed that earlier hardware issues were due to faulty components and not coding errors. The system is reliable, scalable, and ready for enhancements like wireless communication or multi-sensor integration.&lt;/p&gt;

</description>
      <category>arduino</category>
      <category>ai</category>
      <category>security</category>
      <category>distributedsystems</category>
    </item>
    <item>
      <title>AI Transcriptor App</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Sat, 16 Nov 2024 14:48:33 +0000</pubDate>
      <link>https://dev.to/elmerurbina/aitranscriptor-4j3b</link>
      <guid>https://dev.to/elmerurbina/aitranscriptor-4j3b</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/assemblyai"&gt;AssemblyAI Challenge &lt;/a&gt;: Sophisticated Speech-to-Text.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built a web page easy to use, with a responsive design so that it can be used in different devices like laptops, cellphones, tablets, the app is 100% functional, contains an input to upload the file (audio) you want to transcript, a button to start transcribing, once you click this button the transcription will start automatically and the transcribed text will appear just below.&lt;/p&gt;

&lt;p&gt;The web application is deployed so that everyone can access and use it, from any device, from anywhere, in summary I have a ready to use web app for transcribing audios using the Universal -2 model for processing the audio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The code is under the MIT free license, you can reach the GitHub repository &lt;a href="https://github.com/elmerurbina/aitranscriptor" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
The web app is also deployed on Render, which means it have &lt;strong&gt;Usability and Accessibility&lt;/strong&gt;, you can reach and use the application &lt;a href="https://aitranscriptor.onrender.com/aitranscriptor" rel="noopener noreferrer"&gt;Here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The app is 100% functional, you can see it on the screenshot below. &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%2Ftifad7a8euwvdw1h02ec.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%2Ftifad7a8euwvdw1h02ec.png" alt="Evidence of functionalityn" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also the interface is intuitive for anyone who has or not experience using technologies, you can see it on this image.&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%2Fqpkk6dnckd040zo0efb5.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%2Fqpkk6dnckd040zo0efb5.png" alt="GUI for good user experience" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The application design is responsive, can be accessed and used form any device, which means it have a &lt;strong&gt;Good User Experience and Accessibility&lt;/strong&gt;, you can check it out on these screenshots:&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%2Frl6r7r7y3ac8dlwxljsf.jpg" 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%2Frl6r7r7y3ac8dlwxljsf.jpg" alt="Cellphone" width="590" height="1280"&gt;&lt;/a&gt;&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%2F5k6pbkorfzkfi0kz6gyr.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%2F5k6pbkorfzkfi0kz6gyr.png" alt="Standard Tablet Size" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;On the Technology stack I used the traditional HTML, CSS and JS for building a web frontend with &lt;strong&gt;Usability and User Experience&lt;/strong&gt;, In the Backend I used Flask for defining the routes and implementing the logic, I used the &lt;strong&gt;Universal-2, AssamblyAI's Model&lt;/strong&gt; to transcribe the audio, in simple words, the Flask receive the audio, send it to the Assembly AI API (The connection is stablished through the API Key), the API process the audio and send 200 status response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Possible Problems
&lt;/h2&gt;

&lt;p&gt;Flask save the audio on the uploads folder, so when it is deployed on Render the host don't have access to saving and accessing the file on the directory, which can get into errors and the page will not translate, for solve this issue, is needed to use cloud storage for saving the audio and flask access it from the Cloud and not for the uploads directory.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>assemblyaichallenge</category>
      <category>ai</category>
      <category>python</category>
    </item>
    <item>
      <title>Quamtum Computing and its importance</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Mon, 17 Jun 2024 22:38:39 +0000</pubDate>
      <link>https://dev.to/elmerurbina/quamtum-computing-and-its-importance-29on</link>
      <guid>https://dev.to/elmerurbina/quamtum-computing-and-its-importance-29on</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/cs"&gt;DEV Computer Science Challenge v24.06.12: One Byte Explainer&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explainer
&lt;/h2&gt;

&lt;p&gt;Quantum computing is the implementation of quantum mechanic's principles into computers; they're called quantum computers, their most relevant feature is that they can solve problems faster, and problems than traditional computers can't solve.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>cschallenge</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Meet the world most beautiful beaches</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Sat, 08 Jun 2024 00:30:25 +0000</pubDate>
      <link>https://dev.to/elmerurbina/best-beaches-in-the-world-5ghd</link>
      <guid>https://dev.to/elmerurbina/best-beaches-in-the-world-5ghd</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for [Frontend Challenge v24.04.17]((&lt;a href="https://dev.to/challenges/frontend-2024-05-29"&gt;https://dev.to/challenges/frontend-2024-05-29&lt;/a&gt;), Glam Up My Markup: Beaches&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Screenshots of the template. &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%2Fowsj9sbq8tmt31xp9qc1.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%2Fowsj9sbq8tmt31xp9qc1.png" alt=" " width="800" height="412"&gt;&lt;/a&gt;&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%2F0kv36qrpqe65sk222o65.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%2F0kv36qrpqe65sk222o65.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&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%2F7xquxwp7gxwrq2hgojk8.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%2F7xquxwp7gxwrq2hgojk8.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&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%2F1ncyxy8j2xgpo4psstz6.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%2F1ncyxy8j2xgpo4psstz6.png" alt=" " width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/elmerurbina/markUp" rel="noopener noreferrer"&gt;See the code on GitHub &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code have the MIT free licence.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>frontendchallenge</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Earth</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Sun, 21 Apr 2024 02:20:32 +0000</pubDate>
      <link>https://dev.to/elmerurbina/earth-36hk</link>
      <guid>https://dev.to/elmerurbina/earth-36hk</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/devteam/join-us-for-the-next-frontend-challenge-earth-day-edition-52e4"&gt;Frontend Challenge v24.04.17&lt;/a&gt;, Glam Up My Markup: Earth Day Celebration Landing Page&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built a web page with HTML, CSS and JavaScript with some information about the climate change, sustainable practices, and some interesting facts about earth. The goal is promote the sustainable practices, generate awareness on people, and encourage them to care our planet. --&amp;gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;You can find the project deployed on GitHub pages &lt;a href="https://elmerurbina.github.io/earth/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/elmerurbina/earth" rel="noopener noreferrer"&gt;Access the code directly on the repository.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;I developed new skills with JavaScript, language that i am actually learning, as well i put in practice some of my knowledges on climate change and carry it to real life projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;The project is under the MIT free license&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>frontendchallenge</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Translator AI App</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Sat, 06 Apr 2024 15:07:43 +0000</pubDate>
      <link>https://dev.to/elmerurbina/translator-ai-app-40l8</link>
      <guid>https://dev.to/elmerurbina/translator-ai-app-40l8</guid>
      <description>&lt;p&gt;*This is a submission for the &lt;a href="https://dev.to/devteam/join-us-for-the-cloudflare-ai-challenge-3000-in-prizes-5f99"&gt;Cloudflare AI Challenge&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;The web application can recognize automatically the language you are using, and will translate to another language, which user can select on the translate to section, it handle four languages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The main features of the application are:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.** Text input in which you can enter text**, when click on the button translate, the text  you entered will be translated into the language you had selected to &lt;em&gt;translate for&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;2.** Speech recognition:** you can use the microphone to send a voice message and translate to the selected language&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The app handle files translations&lt;/strong&gt; which means you can upload a file, select the language to translate and the web will do the job of extracting the text, translate it and display the translated message on the translated information section&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://241a0829.translator-ai.pages.dev/" rel="noopener noreferrer"&gt;You can access to the deployed project on CloudFlare Pages&lt;br&gt;
&lt;/a&gt;&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%2Fklied3513a151kktm8i3.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%2Fklied3513a151kktm8i3.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My Code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/elmerurbina/translator-ai" rel="noopener noreferrer"&gt;See the code&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;Is the first time i use APIs, I had been working on AI related projects but with Python, so this project allow me to understand clearer how does the API integrations works, I developed the project alone, I want to fix some bugs, add more functionalities and maybe present the project on my University at the end of the year, so it will be fine to find collaborators and growth network.&lt;/p&gt;

</description>
      <category>cloudflarechallenge</category>
      <category>devchallenge</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Develop a Python (Flask) web app and deploy on pythonanywhere: step by step</title>
      <dc:creator>Elmer Urbina Meneses</dc:creator>
      <pubDate>Sat, 06 Apr 2024 05:02:14 +0000</pubDate>
      <link>https://dev.to/elmerurbina/develop-a-python-flask-web-app-and-deploy-on-pythonanywhere-step-by-step-4j0h</link>
      <guid>https://dev.to/elmerurbina/develop-a-python-flask-web-app-and-deploy-on-pythonanywhere-step-by-step-4j0h</guid>
      <description>&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;In this article I will teach you how to develop and deploy a web site, web page or web app, using Python as programming language, Flask as web framework and pythonanywhere.com as a deployment provider. I will guide you step by step since the process of organizing your code directory on your local machine, and then uploading the code to the python anywhere interface for further deployment, I will not teach you to write code my goal is help you to deploy your works projects to be accessible on internet. I'll suppose that you have a basic understanding of python programming as well as the flask framework.&lt;br&gt;
I am not going to make the program but the article is basic on experience since I deployed my personal portfolio, so I will tell you all the true and the process is proven to work, for evidence you can check &lt;a href="//elmerurbina.pythonanywhere/elmerurbina.com"&gt; here&lt;/a&gt;, as well every section is supported with screenshots.&lt;br&gt;
Before we can keep is important to know that deploying on python anywhere is free, but your site's URL will see like: &lt;em&gt;username.pythonanywhere/project-name.com&lt;/em&gt;, if you want to add a custom domain you will have to upgrade for the premium plan, the second fact is that you can host only one web for free, if you want to host more than one web you will have to upgrade, and third once you deploy your web you will have to login at least one every three months, if you don't your web will be closed and for instance not accessible through internet. Now that you know this basic information go ahead with the first step.&lt;/p&gt;
&lt;h2&gt;
  
  
  Organize your project in the local machine
&lt;/h2&gt;

&lt;p&gt;Lets begin with organizing the directories on the computer you are going to work. For develop the code you can use any code editor you like I use PyCharm Community edition, but you can use the on you work comfortable with.&lt;br&gt;
The location in which any files go is crucial, if a file is on the wrong directory it will damage the entire work, so lets see how it should be organized.&lt;br&gt;
The files with the extension &lt;em&gt;.py _will be on the root directory, is the project folder, in the project folder you will have a subfolder named templates in which you will put all the HTML files, go back to the root directory and create another subfolder named static in this subfolder you will put all the CSS, JavaScript files and images. Some people sometimes create subfolders into the static to separate the CSS, JS and images, and it is a good practice for large scale projects in what you need a powerful organization, but in smaller projects it is easier to leave all the CSS, JS and images inside the static directory because when you upload tour files and the deployment site  will search for them on the static folder.&lt;br&gt;
You can have many python files or modules as you want, but the only to consider is app.py, so you have to import your modules and handle the logic to make them work into this file.&lt;br&gt;
When you will access your templates on the python code you will use: return render template _(‘index.html')&lt;/em&gt;, python automatically will search for index.html into the templates folder, the &lt;code&gt;@app.route(‘/project-name')&lt;/code&gt;, the route in this case project-name will the route you will type into the web browser to find your web app.&lt;br&gt;
On the HTML templates when accessing a static file the structure will be like this: &lt;code&gt;url_for{{ (‘static filename=styles’)}}&lt;/code&gt;, for example for adding your styles CSS you will update your code to:        &lt;code&gt;&amp;lt;link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}"&amp;gt;&lt;/code&gt;  . When linking to another Python module your code will be: &lt;code&gt;url_for {{ (‘another-route') }}&lt;/code&gt;, it works when you have a system with more than one route, so if you have another section into your web app, for example a second page, in your app.py you will have a route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @app.route (‘/second-page’)
Def second-page ():
      return render template (‘second-page.html')
your logic here


if __name__ == '__main__':
    app.run(debug=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;just down the route following the python programming rules you will write the logic for the second-page functionality. &lt;/p&gt;

&lt;p&gt;Important when you link the second-page route on HTML, check that if your route and your def name are different, on the &lt;code&gt;url_for{{(‘second-page') }}&lt;/code&gt;, you have to write the def name, because if you use the route it won't work.&lt;br&gt;
Now when you run your html file you will not see your CSS styles applied and your Python backend won't work, to see the result of your code you will run your app.py file, ensure that everything is right and the server is active, after that go to your favorite browser and type the localhost &lt;em&gt;127.0.0.1:5000/project-name&lt;/em&gt;, remember that project name is the route your home or index logic have.&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%2Fukf79cut7bmr1q83917m.jpg" 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%2Fukf79cut7bmr1q83917m.jpg" alt=" " width="710" height="258"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;This screenshot show the structure of your project directory, the .idea folder and the README file are generated by the IDE when you are working with Git control.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now I think you understand important keys of the structure your directory, links and so on must have, once you have your code ready to deploy you can proceed with the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying to pythonanywhere.com
&lt;/h2&gt;

&lt;p&gt;Open your web browser and navigate to the &lt;em&gt;pythonanywhere.com url&lt;/em&gt;, if it is the first time you access this site you will have to create an account, you can use your Google account or start one with your Email, use a password you can remember because you will need it to login, once you finished the registration process that is very intuitive, they will send you an Email to the provided email address, so you will have to confirm your account, ensure to finish it successfully and proceed with the next steps.&lt;br&gt;
Once logged in you will be prompted to the Dashboard page, once here you can see your username and a menu with options like Files, Web, Databases. Go to Web. Once here click on add a new web app, you will be promted to enter the name, name it exactly as your app route on the python code, because the name of the directory is which later will be used in the URL and if you name it different you will have problems to load your page, on the frameworks select Flask, on Python version the last available version, and once you finish the process you can go to files for uploading your codes.&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%2F6bf38bvx5kg7zz23htlf.jpg" 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%2F6bf38bvx5kg7zz23htlf.jpg" alt=" " width="800" height="291"&gt;&lt;/a&gt;&lt;br&gt;
Once you have added your new web app, go back to the dashboard using the backward arrow at the top left corner, and go to Files.&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%2F6ugasgralncvln2v0a6v.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%2F6ugasgralncvln2v0a6v.png" alt=" " width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Into the file section you can upload your app.py file using the upload button, for uploading your templates and statics go to directories, search for directories and type &lt;em&gt;static&lt;/em&gt;, open the folder and upload your files, leave the static folder and repeat the process with the templates files.&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%2Fn6nllbho3yvft6hqoh2o.jpg" 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%2Fn6nllbho3yvft6hqoh2o.jpg" alt=" " width="800" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Every file upload support a maximum 100 MB file size.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Ensure that the project directory after_ home/_ have the exact name of your app route on the python code, on the contrary you will have problems when loading your page, if the name is not which you want you can try to rename it.&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%2Folyymckvjist4mtlawe1.jpg" 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%2Folyymckvjist4mtlawe1.jpg" alt=" " width="800" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have uploaded your files go back to the dashboard using the backward arrow located at the top left corner of the page, now that you are in the dashboard again you can go to the Web menu, located at the right of the File menu,  follow instructions and click on &lt;em&gt;reload page&lt;/em&gt;.&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%2Ffjtxrfpod46ld3g0y8qk.jpg" 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%2Ffjtxrfpod46ld3g0y8qk.jpg" alt=" " width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When it comes to the first time you have to click on run until 3 months from today, so your page will be automatically deployed.&lt;/p&gt;

&lt;p&gt;Python anywhere have another functions like a console to write and run code, but is more comfortable to upload the files directly, the next time you want to update your web, you can click on the file you want to change, it will open the file code, so you can edit it as you want, next click save and reload go back using the backward arrow, go to the web menu and click on reload, now your page will be updated.&lt;br&gt;
You can now check your web on the browser typing the url, generally it comes with the next structure: &lt;em&gt;your_username.pythonanywhere/directory_name.com.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;If I accomplished my mission, you know the structure of a python project, the structure of url on the templates, the meaning and functionality of the routes, and finally how to deploy your web projects developed with the Flask framework on python anywhere.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://help.pythonanywhere.com/pages/Flask/" rel="noopener noreferrer"&gt;for more information read the Flask documentation to deploying a flask app.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>python</category>
      <category>flask</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
