<?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: Pawel Pioro</title>
    <description>The latest articles on DEV Community by Pawel Pioro (@pawel_p).</description>
    <link>https://dev.to/pawel_p</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%2F1280099%2Fe1561be9-fae1-45ee-bf55-fed384253fb7.jpg</url>
      <title>DEV Community: Pawel Pioro</title>
      <link>https://dev.to/pawel_p</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pawel_p"/>
    <language>en</language>
    <item>
      <title>How to become a Full-Stack Developer: A Simple and Fast approach</title>
      <dc:creator>Pawel Pioro</dc:creator>
      <pubDate>Fri, 23 Feb 2024 22:17:32 +0000</pubDate>
      <link>https://dev.to/pawel_p/how-to-become-a-full-stack-developer-a-simple-and-fast-approach-4bd</link>
      <guid>https://dev.to/pawel_p/how-to-become-a-full-stack-developer-a-simple-and-fast-approach-4bd</guid>
      <description>&lt;p&gt;Want to become a full-stack developer? Unsure of what you need to know? Need a helpful point in the right direction? This post will explain how to link your frontend to your backend simply and quickly! &lt;/p&gt;

&lt;p&gt;More specifically, I will give a quick way to link two very popular web technologies together: Django and React! We will use Cors Headers to make this magic happen. I know when I was introduced to Django, creating a frontend was always a challenging task and got complicated very quickly. React was a tool that I learned later, that simplified things, and connecting it to Django was ultimately my end goal. This is why I am writing an article to show this solution!&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;Firstly, you need to have created a Django project with an app called 'backend'. This will be the API for our project. We then need to install Cors Headers so Django allows our React frontend to make requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install django-cors-headers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We now need to install our frontend. I will use Vite for this example. CD: to the root of the project and type the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm create vite@latest frontend-- --template react
cd frontend
npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we need to add cors-headers to our installed apps in settings.py . Make sure it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # added below
    'backend',
    'corsheaders',
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, below, add these lines of code to trust our frontend...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CORS_ALLOWED_ORIGINS = [
    'http://localhost:5173', # default port of react
]

CSRF_TRUSTED_ORIGINS = CORS_ALLOWED_ORIGINS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;... and add this line to the middleware:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    'corsheaders.middleware.CorsMiddleware', # add this line
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that is all you need for settings.py!&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Now we have completed these steps, we can use this project by visiting the react app and making API requests to the backend port (default is 8000). An example of making such a request is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;axios.post('/api/{yourApiView}/', {})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And there you go! You can now connect your react app to your Django backend. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>python</category>
    </item>
    <item>
      <title>Want to become a programmer? This is the fastest way to master Python.</title>
      <dc:creator>Pawel Pioro</dc:creator>
      <pubDate>Wed, 14 Feb 2024 12:03:15 +0000</pubDate>
      <link>https://dev.to/pawel_p/want-to-become-a-programmer-this-is-the-fastest-way-to-master-python-28l9</link>
      <guid>https://dev.to/pawel_p/want-to-become-a-programmer-this-is-the-fastest-way-to-master-python-28l9</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb90r8wvj6qj1antdn3j7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb90r8wvj6qj1antdn3j7.png" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are you a beginner in programming? Do you want to master your first programming language? Are you unsure on how to do this? Or maybe you want to refresh your Python skills?&lt;/strong&gt; If so, this post is for you as I explain how you can learn Python in the best way.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;Why Python?&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Firstly, why Python? Python has been one of the most popular programming languages for the past few years and will remain at the top. You can essentially do anything with Python, thanks to its large number of libraries and huge community. You probably are aware of why Python is the best choice for beginners, so I won't dwell too much on this.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;How can I learn Python as quickly as possible?&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Many go down the route of watching videos on YouTube. Although this is fine to get familiar with the syntax (how the language is written), many important concepts will simply not stick and be forgotten. I believe videos can be very helpful, however, they shouldn't be relied on and you must have hands-on practice actually coding in Python as that is the end goal! &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;So what is the best way to learn Python?&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;I believe the best way is through a course. More specifically, &lt;strong&gt;CS50P&lt;/strong&gt;. The course, which is offered by Harvard University, has the perfect balance between videos and small projects that assess a specific skill that you have learned. It can seem daunting at first, but you can work on each problem set at your own pace. It doesn't matter if a problem takes a day, a week, or even a few weeks. After completing this course, I can confirm that it's a very valuable resource that we all have access to. You get a certificate that you can put on your resume to prove you have the essential skills in Python - for free! I strongly advise you to check the course: &lt;a href="https://www.edx.org/learn/python/harvard-university-cs50-s-introduction-to-programming-with-python"&gt;Harvard's CS50P Course&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmcji9hnd5n76ylogl8us.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmcji9hnd5n76ylogl8us.png" alt="Image description" width="530" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;I have completed the course, what now?&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;If you have completed the course, you know the syntax of Python and have additional experience with more intermediate topics such as unit testing and OOP. You may not be ready to get a job yet, however, with the skills you have, you can start to learn any framework or library. If you are completely unsure, I recommend another CS50 course - &lt;a href="https://www.edx.org/learn/web-development/harvard-university-cs50-s-web-programming-with-python-and-javascript"&gt;Harvard's CS50W Course&lt;/a&gt;. This course is a little more complex, however, it will teach so much valuable material that it makes it worth it. At this point, you can strongly say you have achieved your goals and are a programmer!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you have any questions or have a suggestion for a different learning material, feel free to comment. I look forward to hearing from you!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>coding</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
