<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Shrikant Dhayje]]></title><description><![CDATA[I'm a software developer from India. :india:

I live in Shrirampur City, Maharastra :india:

I'm currently learning Back-end Web Developing via Python Programming Language.]]></description><link>https://shriekdj.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 11:25:09 GMT</lastBuildDate><atom:link href="https://shriekdj.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Add Google Ad Sense in Next.js 13 With App Router, Auto Ads and Unit Ads]]></title><description><![CDATA[Hello everyone! Today, I'm going to talk about how to run Google AdSense and Google AdSense ad units. We can add the AdSense code in the head tag of a…]]></description><link>https://shriekdj.hashnode.dev/how-to-add-google-ad-sense-in-nextjs-13-with-app-router-auto-ads-and-unit-ads</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/how-to-add-google-ad-sense-in-nextjs-13-with-app-router-auto-ads-and-unit-ads</guid><category><![CDATA[GoogleAdsense]]></category><category><![CDATA[nextjs13]]></category><category><![CDATA[nextjs 13]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[google adsense ad units]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Thu, 22 Jun 2023 15:35:32 GMT</pubDate><content:encoded><![CDATA[<p>Hello everyone! Today, I'm going to talk about how to run Google AdSense and Google AdSense ad units.</p>
<h3 id="heading-the-problem">The Problem</h3>
<p>We can add the AdSense code in the <code>head</code> tag of a Next.js 13 app router, but the problem arises when dealing with <strong>Google AdSense ad units</strong>. When using the new method, we have to assign our ad component as a client, but the AdSense ad unit code does not refresh on page changes.</p>
<h3 id="heading-solution-1-auto-ads-follow-this-for-ad-units-as-well">Solution 1: Auto Ads (Follow this for ad units as well)</h3>
<p>Firstly, go to the <code>RootLayout</code> component, which looks like the following:</p>
<pre><code class="lang-tsx">export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    &lt;html lang="en"&gt;
      &lt;head&gt;&lt;/head&gt;
      &lt;body className="bg-gray-100 font-sans"&gt;{children}&lt;/body&gt;
    &lt;/html&gt;
  );
}
</code></pre>
<p>The Google AdSense code you need to convert is as follows:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">async</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456"</span> <span class="hljs-attr">crossorigin</span> /&gt;</span>
</code></pre>
<p>Now, convert the code to a Next.js <code>Script</code> component:</p>
<pre><code class="lang-jsx">&lt;Script
  <span class="hljs-keyword">async</span>
  src=<span class="hljs-string">"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456"</span>
  crossOrigin=<span class="hljs-string">"anonymous"</span>
  strategy=<span class="hljs-string">"lazyOnload"</span>
/&gt;
</code></pre>
<p>Simply add this code to the <code>head</code> tag, and remember that the <code>strategy</code> should be set to <code>lazyOnload</code>, which increases the chances of the code running fine. Also, set <code>crossOrigin</code> to <code>"anonymous"</code>.</p>
<h3 id="heading-solution-2-google-adsense-ad-unit-codes-in-app-router">Solution 2: Google AdSense Ad Unit Codes in App Router</h3>
<p>Now, you have the code from the Google AdSense ad unit, which looks like this:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">async</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456"</span> <span class="hljs-attr">crossorigin</span>=<span class="hljs-string">"anonymous"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
<span class="hljs-comment">&lt;!-- Homepage Leaderboard --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">ins</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"adsbygoogle"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"display:inline-block;width:728px;height:90px"</span> <span class="hljs-attr">data-ad-client</span>=<span class="hljs-string">"ca-pub-1234567890123456"</span> <span class="hljs-attr">data-ad-slot</span>=<span class="hljs-string">"1234567890"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ins</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
(<span class="hljs-built_in">window</span>.adsbygoogle = <span class="hljs-built_in">window</span>.adsbygoogle || []).push({});
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<p>The first part of the code (the first <code>script</code> tag) is already rendered in the <code>head</code> tag, as we added it in the auto ads solution. So, we will focus on the remaining code.</p>
<p>After converting it to the Next.js version, it looks like this:</p>
<pre><code class="lang-jsx">&lt;ins
  className=<span class="hljs-string">"adsbygoogle"</span>
  style={{ <span class="hljs-attr">display</span>: <span class="hljs-string">"inline-block"</span>, <span class="hljs-attr">width</span>: <span class="hljs-number">728</span>, <span class="hljs-attr">height</span>: <span class="hljs-number">90</span> }}
  data-ad-client=<span class="hljs-string">"ca-pub-1234567890123456"</span>
  data-ad-slot={<span class="hljs-number">1234567890</span>}
/&gt;
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">dangerouslySetInnerHTML</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">__html:</span> "(<span class="hljs-attr">window.adsbygoogle</span> = <span class="hljs-string">window.adsbygoogle</span> || [])<span class="hljs-attr">.push</span>({});" }} /&gt;</span></span>
</code></pre>
<p>You can now add this code. However, there is an issue: the page needs to be refreshed for the ad to load, and it doesn't load again on other pages due to the smooth navigation of Next.js.</p>
<p>To resolve this, we need to update our code, which might seem complex but it works completely.</p>
<p>First, create a new <code>AdCode.jsx</code> file. <strong>Note:</strong> It should be in JSX format, not <code>.ts</code>.</p>
<p>First, add the following code in a class component (do not use a function component with <code>useEffect()</code> as it only works partially):</p>
<pre><code class="lang-jsx"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AdCodeWithoutRouter</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">React</span>.<span class="hljs-title">Component</span> </span>{
  renderAds() {
    (<span class="hljs-built_in">window</span>.adsbygoogle = <span class="hljs-built_in">window</span>.adsbygoogle || []).push({});
  }

  componentDidMount() {
    <span class="hljs-built_in">this</span>.renderAds();
  }

  componentDidUpdate(prevProps) {
    <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.props.router.asPath !== prevProps.router.asPath) {
      <span class="hljs-built_in">this</span>.renderAds();
    }
  }

  render() {
    <span class="hljs-keyword">return</span> (
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"container mx-auto text-center"</span> <span class="hljs-attr">aria-hidden</span>=<span class="hljs-string">{true}</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">ins</span>
          <span class="hljs-attr">className</span>=<span class="hljs-string">"adsbygoogle"</span>
          <span class="hljs-attr">style</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">display:</span> '<span class="hljs-attr">block</span>', <span class="hljs-attr">width:</span> '<span class="hljs-attr">100</span>%' }}
          <span class="hljs-attr">data-ad-client</span>=<span class="hljs-string">"ca-pub-1234567890"</span>
          <span class="hljs-attr">data-ad-slot</span>=<span class="hljs-string">"123456"</span>
          <span class="hljs-attr">data-ad-format</span>=<span class="hljs-string">"auto"</span>
          <span class="hljs-attr">data-full-width-responsive</span>=<span class="hljs-string">"true"</span>
        &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ins</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
    );
  }
}
</code></pre>
<p>Next, you need to import some modules and modify the function component. The complete file will look like this. Make sure to import <code>useRouter</code> from <code>'next/navigation'</code> in Next.js 13:</p>
<pre><code class="lang-jsx"><span class="hljs-string">'use client'</span>;
<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { useRouter } <span class="hljs-keyword">from</span> <span class="hljs-string">'next/navigation'</span>;

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AdCodeWithoutRouter</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">React</span>.<span class="hljs-title">Component</span> </span>{
  renderAds() {
    (<span class="hljs-built_in">window</span>.adsbygoogle = <span class="hljs-built_in">window</span>.adsbygoogle || []).push({});
  }

  componentDidMount() {
    <span class="hljs-built_in">this</span>.renderAds();
  }

  componentDidUpdate(prevProps) {
    <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.props.router.asPath !== prevProps.router.asPath) {
      <span class="hljs-built_in">this</span>.renderAds();
    }
  }

  render() {
    <span class="hljs-keyword">return</span> (
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"container mx-auto text-center"</span> <span class="hljs-attr">aria-hidden</span>=<span class="hljs-string">{true}</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">ins</span>
          <span class="hljs-attr">className</span>=<span class="hljs-string">"adsbygoogle"</span>
          <span class="hljs-attr">style</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">display:</span> '<span class="hljs-attr">block</span>', <span class="hljs-attr">width:</span> '<span class="hljs-attr">100</span>%' }}
          <span class="hljs-attr">data-ad-client</span>=<span class="hljs-string">"ca-pub-1234567890"</span>
          <span class="hljs-attr">data-ad-slot</span>=<span class="hljs-string">"123456"</span>
          <span class="hljs-attr">data-ad-format</span>=<span class="hljs-string">"auto"</span>
          <span class="hljs-attr">data-full-width-responsive</span>=<span class="hljs-string">"true"</span>
        &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ins</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">dangerouslySetInnerHTML</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">__html:</span> '(<span class="hljs-attr">window.adsbygoogle</span> = <span class="hljs-string">window.adsbygoogle</span> || [])<span class="hljs-attr">.push</span>({});' }}&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
    );
  }
}

<span class="hljs-keyword">const</span> AdCode = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> router = useRouter();
  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AdCodeWithoutRouter</span> <span class="hljs-attr">router</span>=<span class="hljs-string">{router}</span> /&gt;</span></span>;
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> AdCode;
</code></pre>
<p>In the modified code, the <code>componentDidMount</code> function runs when the component is first loaded, and <code>componentDidUpdate</code> is triggered when navigating to new pages. These functions ensure that the ads are rendered correctly.</p>
<p>Finally, you can use the <code>AdCode</code> component wherever you need it.</p>
<p>Bye.</p>
<blockquote>
<p>Please note that the above code assumes you are using Next.js version 13. Make sure to import the correct modules and follow the appropriate syntax based on your Next.js version.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[MongoDB Error: couldn’t connect to server 127.0.0.1:27017 on Windows]]></title><description><![CDATA[having MongoDB Error: couldn’t connect to server 127.0.0.1:27017 on Windows Machine and Unable to Connect It at all]]></description><link>https://shriekdj.hashnode.dev/mongodb-error-couldnt-connect-to-server-12700127017-on-windows</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/mongodb-error-couldnt-connect-to-server-12700127017-on-windows</guid><category><![CDATA[MongoDB]]></category><category><![CDATA[mongodb compass]]></category><category><![CDATA[Windows]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[unable-to-connect-mongodb]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Mon, 13 Mar 2023 17:47:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1678470141303/6133a833-886e-46ac-b2da-a0eeae3341a6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-problem">Problem</h2>
<blockquote>
<p>Error: couldn’t connect to server 127.0.0.1:27017 for <strong>MongoDB</strong> on <em>Windows</em></p>
<blockquote>
<p>This problem can occur if you install MongoDB without selecting the install as a service option or if you disable its auto start on startup.</p>
</blockquote>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678725812782/0575e324-530e-404f-bea9-bd12b98071a8.png" alt="MongoDB Error: couldn’t connect to server 127.0.0.1:27017 on Windows" class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-details">Details</h2>
<blockquote>
<p>MongoDB made multiple projects to install, so it's confusing to install it for Windows users who only like to install programs via Installer. And this issue also occurs if you install the MongoDB server in the wrong manner.</p>
<blockquote>
<p>Safest Installer But bigger in file size and app size installer is at <a target="_blank" href="https://www.mongodb.com/try/download/community">MongoDB Community Server Download or</a></p>
</blockquote>
</blockquote>
<hr />
<h2 id="heading-first-solution">First Solution</h2>
<blockquote>
<p>For <code>localhost</code> or <code>127.0.0.1</code>.</p>
<blockquote>
<p>Search for <em>Services</em> in start search bar of windows and <code>Start</code> the Service named <code>MongoDB</code> or <code>MongoDB Server (MongoDB)</code> by Right Clicking and Clicking Start.</p>
</blockquote>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678728624733/0c62377e-7d70-4a43-9120-943a2f44edf3.png" alt="Trying to Start MongoDB Service in Windows Services App" class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-second-solution">Second Solution</h2>
<blockquote>
<p>This is also for `localhosted</p>
<blockquote>
<p>Install the appropriate MongoDB Stack or the more sophisticated MongoDB Community Server, the link to which I have given above. Either reinstall the complete software packages, such as MongoDB Compass and Mongosh Shell (MongoDB Shell (Mongosh) is distinct from Atlas Shell).</p>
</blockquote>
</blockquote>
<hr />
<h2 id="heading-third-solution">Third Solution</h2>
<p>Use Third Party or Opensource Admin Panel of MongoDB. I am not promoting any software at all and can't list all but these are some which are mostly free software to use.</p>
<ul>
<li><p>Appsmith ( Opensource Easiest if using docker under Linux Container)</p>
</li>
<li><p>Retool ( Proprietary with Free Trial )</p>
</li>
<li><p>UI Bakery</p>
</li>
<li><p>Budibase</p>
</li>
<li><p>Tooljet ( Opensource, but does not automatically adds field name for table columns )</p>
</li>
</ul>
<p>bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[How to Merge Multiple Data frames with same columns In Pandas | Python]]></title><description><![CDATA[Data Science Projects.]]></description><link>https://shriekdj.hashnode.dev/how-to-merge-multiple-data-frames-with-same-columns-in-pandas-python</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/how-to-merge-multiple-data-frames-with-same-columns-in-pandas-python</guid><category><![CDATA[pandas]]></category><category><![CDATA[Data Science]]></category><category><![CDATA[Python]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[merge]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Sun, 16 Oct 2022 13:30:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1665849272440/UApn3ra4b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello Everybody, So Today I just faced this issue of merging multiple excels in one and there size was too big for merging like more 100 MB for Size and In Some Cases the size spans more and if we tried to search any online tool they mostly have size limit for merging the excel files with same columns.</p>
<p>I Know there is pd.merge function but I like simple.</p>
<p>So I Just Decided to merge my file as given below.</p>
<p>So My Code Is in Jupyter Notebook and I am Pasting it's Markdown version as given below.</p>
<h3 id="heading-firstly-we-will-need-to-import-pandas-and-glob-package">Firstly we will need to Import pandas and glob package</h3>
<p><code>pandas</code> for dataframe and glob for getting the list of all files in whatever folder that we want</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">from</span> glob <span class="hljs-keyword">import</span> glob
</code></pre>
<h3 id="heading-get-list-file-all-file-names-in-a-variable-named-listofallfiles-like-given-below">Get List file all file names in a variable named <code>list_of_all_files</code> like given below</h3>
<pre><code class="lang-python">list_of_all_files = glob(<span class="hljs-string">r'B:\dev\test_folder\*.xlsx'</span>)
list_of_all_files
</code></pre>
<pre><code class="lang-python">    [<span class="hljs-string">'B:\\dev\\test_folder\\test.xlsx'</span>,
     <span class="hljs-string">'B:\\dev\\test_folder\\test2.xlsx'</span>,
     <span class="hljs-string">'B:\\dev\\test_folder\\test3.xlsx'</span>,
     <span class="hljs-string">'B:\\dev\\test_folder\\test4.xlsx'</span>,
     <span class="hljs-string">'B:\\dev\\test_folder\\test5.xlsx'</span>]
</code></pre>
<h3 id="heading-read-each-and-every-file-and-get-list-of-pandas-dataframes">Read Each and Every file and get list of Pandas Dataframes</h3>
<pre><code class="lang-python">all_dfs = [pd.read_excel(file, <span class="hljs-string">'Sheet1'</span>) <span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> list_of_all_files]
all_dfs
</code></pre>
<pre><code class="lang-plaintext">
    [                       Name of the Establishment  \
     0                M/S, RASHAONTHA AIRCONDITIONERS   
     1                 Micro Plastics Private Limited   
     2                           RBL FINSERVE LIMITED   
     3                                RAM ENTERPRISES   
     4   S3 GROUP INDIA LIMITED LIABILITY PARTNERSHIP   
     5                                        ADGROWW   
     6         LOKADITYA PROPERTIES AND CONSTRUCTIONS   
     7                           JAI AMBE ENTERPRISES   
     8                                AARTHA THAI SPA   
     9                   D N NANDI EXCELLENT SERVICES   
     10                    YULU BIKES PRIVATE LIMITED   
     11                                      MIG CAFE   
     12                     VNF IDEAS PRIVATE LIMITED   
     13                     VNF IDEAS PRIVATE LIMITED   
     14                        Prasanna N Rajapurohit   
     15                            SILVERLINE CLINICS   
     16                KALYANI AURA WORKSPACE PVT LTD   

                          Name of the Employer.  \
     0                 Mr.LOKESH G, Mr.LOKESH G   
     1                          VIJENDRA BABU N   
     2                     VIKAS UPENDRA MUTTOO   
     3                                  S MEERA   
     4                          KRISHNAMURTHY M   
     5                               DEEPAK P R   
     6                                HEMANTH K   
     7                   MEHERNOSH NOSHIR PATEL   
     8                              ROSE MARY G   
     9                        Dileep Kumara K S   
     10                          Naveen Dachuri   
     11                  Malleshwar Rao Dhavili   
     12                              Atul Kumar   
     13                              Atul Kumar   
     14                  Prasanna N Rajapurohit   
     15  KANAJENAHALLI NARAYANAPPA SATHISH BABU   
     16                            A MOHAN RAJU   

     ...  

                                        Nature of Business  
     0   Coaching Centre-Student counselling for overse...  
     1                                        SUPER MARKET  
     2   Technical and Professional Skill Development a...  
     3                               INTERIOR AND WOODWORK  
     4       Learning and Activity Centre For Special Kids  
     5           Family Office and Trust Planning Services  
     6   Handloom Cloth, Mill Goods, Hosieries, Dress M...  
     7   Web Development Web Designing Services And Pro...  
     8          Security/House keeping and Allied Services  
     9                                Software Development  
     10                 Mangoes and Mango products Trading  
     11                                    RESTAURANT,CAFE  
     12      Selling Fruits, Vegetables and Dairy Products  
     13      Selling Fruits,Vegetables and Dairy products.  
     14                 Works Contract for Government work  
     15                                   Medical Hospital  
     16                 Commercial &amp; Office Space Provider  ,
                              Name of the Establishment  \
     0                                KLAYWORKZ BARISTA   
     1                      DWIJA FOODS PRIVATE LIMITED   
     2   M/s INNATERA NANOSYSTEMS INDIA PRIVATE LIMITED   
     3                                  PARISHIKA GROUP   
     4          FOURDEGREEWATER CAPITAL PRIVATE LIMITED   
     5                                       RAYSUN LED   
     6             FORETHOUGHT VENTURES PRIVATE LIMITED   
     7        REVENUESTACK TECHNOLOGIES PRIVATE LIMITED   
     8            CODELINEAR SOFTWARE SOLUTIONS PVT LTD   
     9                             M/S VAISHNAVI INCORP   
     10                                 DINERO VENTURES   
     11                              GENESIS PHOTOBOOKS   
     12               M/s KNOWSPRING FINANCIAL ADVISORS   
     13                         M/S ICL FINCORP LIMITED   
     14  VATSALA CONSTRUCTIONS AND CONSULTANTS PVT.LTD.   

                                     Name of the Employer.  \
     0                                              SAMPAT   
     1   JAYATI DIBAKAR CHATTERJEE, DIBAKAR SATYABRATA ...   
     2                                    Sri S Uma Mahesh   
     3                           Chandan Nagaraj, Jeevitha   
     4   Anshul Gupta, Ajinkya Mukund Kulkarni, Abhik J...   
     5                                           PRAKASH M   
     6    DOMMASANDRA MALLIKARJUNA GOWRI SHANKAR, NACHAPPA   
     7                          YESHU SINGH, SANDEEP SINGH   
     8                       Syed Muheeb, Muheeb Syed Saif   
     9                               Mr M K Harshith Kumar   
     10                        GRISHMA RAMANA PRASAD REDDY   
     11                                          A C AKASH   
     12                                 Monika Prabhakaran   
     13                                 SRI. KG ANIL KUMAR   
     14                                     H S Vishwanath   

                                        Nature of Business  
     0                                   Hotel/ Restaurant  
     1                           Beverage Vending Services  
     2                           IT Design and Development  
     3                                  Bar and Restaurant  
     4   Commercial Establishment engaged in business o...  
     5           LED LIGHTS MANUFACTURING TRADING SERVICES  
     6                               HOTEL AND RESTAURANTS  
     7   all related services and consultancy services ...  
     8   Designing, Developing, Maintaining Website and...  
     9   Manpower Consultancy,Staffing, Security, House...  
     10                               Consultancy Services  
     11          Printing and Printing Systems, and Others  
     12                              PROFESSIONAL SERVICES  
     13                                          GOLD LOAN  
     14                       Construction and Civil works  ]
</code></pre>
<p>They are not visible like table because they are not merged given below is visualization of first data frame.</p>
<pre><code class="lang-python">all_dfs[<span class="hljs-number">0</span>]
</code></pre>
<div class="hn-table">
<table>
<thead>
<tr>
<td></td><td>Name of the Establishment</td><td>Name of the Employer.</td><td>Nature of Business</td></tr>
</thead>
<tbody>
<tr>
<td>0</td><td>M/S, RASHAONTHA AIRCONDITIONERS</td><td>Mr.LOKESH G, Mr.LOKESH G</td><td>Sales and Service of Airconditioners</td></tr>
<tr>
<td>1</td><td>Micro Plastics Private Limited</td><td>VIJENDRA BABU N</td><td>Corporate Office</td></tr>
<tr>
<td>2</td><td>RBL FINSERVE LIMITED</td><td>VIKAS UPENDRA MUTTOO</td><td>Business Correspondent</td></tr>
<tr>
<td>3</td><td>RAM ENTERPRISES</td><td>S MEERA</td><td>PACKAGING METERIAL TRADING SERVICES</td></tr>
<tr>
<td>4</td><td>S3 GROUP INDIA LIMITED LIABILITY PARTNERSHIP</td><td>KRISHNAMURTHY M</td><td>IT SOLUTIONS</td></tr>
<tr>
<td>5</td><td>ADGROWW</td><td>DEEPAK P R</td><td>B P O SERVICES</td></tr>
<tr>
<td>6</td><td>LOKADITYA PROPERTIES AND CONSTRUCTIONS</td><td>HEMANTH K</td><td>CONSTRUCTIONS</td></tr>
<tr>
<td>7</td><td>JAI AMBE ENTERPRISES</td><td>MEHERNOSH NOSHIR PATEL</td><td>SECURITY AND HOUSE KEEPING MANPOWER SERVICES</td></tr>
<tr>
<td>8</td><td>AARTHA THAI SPA</td><td>ROSE MARY G</td><td>SPA AND SALOON</td></tr>
<tr>
<td>9</td><td>D N NANDI EXCELLENT SERVICES</td><td>Dileep Kumara K S</td><td>House Keeping And Sump Cleaning</td></tr>
<tr>
<td>10</td><td>YULU BIKES PRIVATE LIMITED</td><td>Naveen Dachuri</td><td>EV Battery Charging &amp; Swapping</td></tr>
<tr>
<td>11</td><td>MIG CAFE</td><td>Malleshwar Rao Dhavili</td><td>RESTAURANT,CAFE</td></tr>
<tr>
<td>12</td><td>VNF IDEAS PRIVATE LIMITED</td><td>Atul Kumar</td><td>Selling Fruits, Vegetables and Dairy Products</td></tr>
<tr>
<td>13</td><td>VNF IDEAS PRIVATE LIMITED</td><td>Atul Kumar</td><td>Selling Fruits,Vegetables and Dairy products.</td></tr>
<tr>
<td>14</td><td>Prasanna N Rajapurohit</td><td>Prasanna N Rajapurohit</td><td>Works Contract for Government work</td></tr>
<tr>
<td>15</td><td>SILVERLINE CLINICS</td><td>KANAJENAHALLI NARAYANAPPA SATHISH BABU</td><td>Medical Hospital</td></tr>
<tr>
<td>16</td><td>KALYANI AURA WORKSPACE PVT LTD</td><td>A MOHAN RAJU</td><td>Commercial &amp; Office Space Provider</td></tr>
</tbody>
</table>
</div><h3 id="heading-now-we-are-gonna-merge-all-data-frames-in-one-like-given-below">Now we are gonna merge all data frames in one, like given below</h3>
<blockquote>
<p>Be Aware that at given below line of code the ignore_index=True is mandatory because the index column can be duplicate for each file and may overwrite instead of merging all df into one.</p>
</blockquote>
<pre><code class="lang-python">single_merged_df = pd.concat(all_dfs, ignore_index=<span class="hljs-literal">True</span>)
single_merged_df
</code></pre>
<div class="hn-table">
<table>
<thead>
<tr>
<td></td><td>Name of the Establishment</td><td>Name of the Employer.</td><td>Nature of Business</td></tr>
</thead>
<tbody>
<tr>
<td>0</td><td>M/S, RASHAONTHA AIRCONDITIONERS</td><td>Mr.LOKESH G, Mr.LOKESH G</td><td>Sales and Service of Airconditioners</td></tr>
<tr>
<td>1</td><td>Micro Plastics Private Limited</td><td>VIJENDRA BABU N</td><td>Corporate Office</td></tr>
<tr>
<td>2</td><td>RBL FINSERVE LIMITED</td><td>VIKAS UPENDRA MUTTOO</td><td>Business Correspondent</td></tr>
<tr>
<td>3</td><td>RAM ENTERPRISES</td><td>S MEERA</td><td>PACKAGING METERIAL TRADING SERVICES</td></tr>
<tr>
<td>4</td><td>S3 GROUP INDIA LIMITED LIABILITY PARTNERSHIP</td><td>KRISHNAMURTHY M</td><td>IT SOLUTIONS</td></tr>
<tr>
<td>...</td><td>...</td><td>...</td><td>...</td></tr>
<tr>
<td>77</td><td>DINERO VENTURES</td><td>GRISHMA RAMANA PRASAD REDDY</td><td>Consultancy Services</td></tr>
<tr>
<td>78</td><td>GENESIS PHOTOBOOKS</td><td>A C AKASH</td><td>Printing and Printing Systems, and Others</td></tr>
<tr>
<td>79</td><td>M/s KNOWSPRING FINANCIAL ADVISORS</td><td>Monika Prabhakaran</td><td>PROFESSIONAL SERVICES</td></tr>
<tr>
<td>80</td><td>M/S ICL FINCORP LIMITED</td><td>SRI. KG ANIL KUMAR</td><td>GOLD LOAN</td></tr>
<tr>
<td>81</td><td>VATSALA CONSTRUCTIONS AND CONSULTANTS PVT.LTD.</td><td>H S Vishwanath</td><td>Construction and Civil works</td></tr>
</tbody>
</table>
</div><p>82 rows × 3 columns</p>
<p>As you can see like above code you can merge multiple data frame into one. and now just export your data frame in whatever format you want like csv, xlsx or anything else.</p>
]]></content:encoded></item><item><title><![CDATA[How to work with Python's normal venv and pipenv simultaneously]]></title><description><![CDATA[Want to Use pipenv but do not want my venv folder to built in my automatically decided location and also want to use pipenv automatically build a method…]]></description><link>https://shriekdj.hashnode.dev/how-to-work-with-pythons-normal-venv-and-pipenv-simultaneously</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/how-to-work-with-pythons-normal-venv-and-pipenv-simultaneously</guid><category><![CDATA[Python]]></category><category><![CDATA[virtual environment]]></category><category><![CDATA[pipenv]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[shriekdj]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Mon, 29 Aug 2022 16:56:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1661792057207/FUTAiRZCo.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-why-need-to-solve-this-issue">Why Need to solve this issue.</h2>
<p>So I Just Want to Use pipenv but do not want my <code>venv</code> folder to built in my automatically decided location and also want to use <code>pipenv</code> automatically building the <code>requirements</code> list.</p>
<p>So For Resolving this issue I build a method of how to do that.</p>
<p>Straight to the Point The Steps are given below.</p>
<h3 id="heading-create-virtual-environment-normally-with-venv-module">Create Virtual Environment normally with <code>venv</code> module</h3>
<h4 id="heading-for-windows">For Windows</h4>
<pre><code class="lang-powershell">py <span class="hljs-literal">-3</span> <span class="hljs-literal">-m</span> venv venv_folder
</code></pre>
<h4 id="heading-for-linux-or-mac-operating-system">For Linux or Mac Operating System</h4>
<pre><code class="lang-bash">python -m venv venv_folder
</code></pre>
<p>or</p>
<pre><code class="lang-bash">python3 -m venv venv_folder
</code></pre>
<h3 id="heading-activate-the-manually-created-virtual-environment-folder">Activate the manually created virtual environment folder</h3>
<h4 id="heading-for-windows-1">For Windows</h4>
<pre><code class="lang-bash"><span class="hljs-comment"># for windows powershell</span>
./venv_folder/Scripts/Activate.ps1

<span class="hljs-comment"># for windows cmd</span>
./venv_folder/Scripts/activate.bat

<span class="hljs-comment"># for windows with posix shell like git bash cli</span>
<span class="hljs-built_in">source</span> venv_folder/Scripts/activate
</code></pre>
<h4 id="heading-for-linux-based-operating-system-or-macos">For Linux Based operating system or MacOS</h4>
<pre><code class="lang-bash"><span class="hljs-built_in">source</span> venv_folder/bin/activate
</code></pre>
<p>if you have any issues activating the venv please refer below post</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://shriekdj.hashnode.dev/how-to-create-and-activate-the-virtual-environment-for-python3-project">https://shriekdj.hashnode.dev/how-to-create-and-activate-the-virtual-environment-for-python3-project</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://shriekdj.hashnode.dev/python-venv-or-virtualenv-wont-activate-on-windows">https://shriekdj.hashnode.dev/python-venv-or-virtualenv-wont-activate-on-windows</a></div>
<h3 id="heading-install-pipenv-twice">Install pipenv twice</h3>
<p>Install the pipenv like given below</p>
<pre><code class="lang-bash">pip install pipenv

pipenv install pipenv
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own <span class="hljs-keyword">for</span> any project. You can <span class="hljs-built_in">set</span> PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can <span class="hljs-built_in">set</span> PIPENV_VERBOSITY=-1 to suppress this warning.
Installing pipenv...
...
</code></pre>
<h3 id="heading-now-install-packages-with-pipenv-as-normal">Now install packages with pipenv as normal</h3>
<p>You will now have pipenv and venv_folder both at the same time to run it.</p>
]]></content:encoded></item><item><title><![CDATA[Get user location from browser using JavaScript | Solutions By ShriekDj]]></title><description><![CDATA[So today i am gonna share you some code and details about how to ask the customer there own location and submit in a form using Geolocation API of Web…]]></description><link>https://shriekdj.hashnode.dev/get-user-location-from-browser-using-javascript-solutions-by-shriekdj</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/get-user-location-from-browser-using-javascript-solutions-by-shriekdj</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[DOM]]></category><category><![CDATA[geolocation]]></category><category><![CDATA[geolocation api]]></category><category><![CDATA[shriekdj]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Fri, 26 Aug 2022 16:42:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1661532081561/MyISkjGLD.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So today i am gonna share you some code and details about how to ask the customer there own location and submit in a form using Geolocation API of Web Browser Using JavaScript.</p>
<p>But Before Copying and Pasting the Code Be Aware this feature only work on <code>https</code> protocol not <code>http</code>, but weirdly able to run on <code>localhost</code>.</p>
<h3 id="heading-1-create-an-html-boilerplate">1. Create an HTML Boilerplate</h3>
<p>The HTML Boilerplate Given below.</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"X-UA-Compatible"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"IE=edge"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Geolocation Form<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    Hello World
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h3 id="heading-2-create-and-form-in-the-body">2. Create and Form in  the body</h3>
<p>We will get user location in latitude and longitude format like given below.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"submit_location"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"post"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"number"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"lat"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"latitude"</span> <span class="hljs-attr">required</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"number"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"long"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"longitude"</span> <span class="hljs-attr">required</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"user_data"</span>&gt;</span>Add User Data<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"user_data"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"user_data"</span> <span class="hljs-attr">required</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit The Data<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
</code></pre>
<h3 id="heading-3-make-latitude-and-longitude-hidden">3. Make Latitude and Longitude hidden.</h3>
<p>For many times user don't want to see or don't need at all to see the latitude and longitude in front of them. for that case. change the form as follows.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"submit_location"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"post"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"hidden"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"latitude"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"lat"</span> <span class="hljs-attr">required</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"hidden"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"longitude"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"long"</span> <span class="hljs-attr">required</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"user_data"</span>&gt;</span>Add User Data<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"user_data"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"user_data"</span> <span class="hljs-attr">required</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit The Data<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
</code></pre>
<h3 id="heading-3-create-javascript-function-to-ask-customer-for-there-location-and-register-it">3. Create JavaScript Function to Ask Customer for there location and register it.</h3>
<p>Given Below Code Contains 3 Types of logic to run as per client interaction.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">myFunction</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// this will be called when my function is needed</span>
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'location captured'</span>);
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getLocation</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">if</span> (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition, removeForm);
        <span class="hljs-keyword">if</span> ((lat.getAttribute(<span class="hljs-string">'value'</span>) == <span class="hljs-literal">null</span>) || (long.getAttribute(<span class="hljs-string">'value'</span>) == <span class="hljs-literal">null</span>)) {

            <span class="hljs-comment">// code to run if cs disagrees to share the location</span>
            <span class="hljs-comment">// x.innerHTML = "Form Can't be uploaded Until you provide your current location";</span>
        }

    } <span class="hljs-keyword">else</span> {

        <span class="hljs-comment">// if client browser does not supports geolocation at all</span>
        <span class="hljs-comment">// x.innerHTML = "Geolocation is not supported by this browser.";</span>
    }
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">showPosition</span>(<span class="hljs-params">position</span>) </span>{
    <span class="hljs-comment">// code to run if cs agrees to share the location</span>
    <span class="hljs-comment">// x.innerHTML = "Now You Can Submit the Form";</span>
    lat.setAttribute(<span class="hljs-string">'value'</span>, position.coords.latitude);
    long.setAttribute(<span class="hljs-string">'value'</span>, position.coords.longitude);
}
</code></pre>
<h3 id="heading-4-lastly-run-the-all-script-function-on-full-page-load">4. Lastly Run the all script function on full page load.</h3>
<p>Given Below is code is used when we want to <strong>run a function when the page is loaded</strong>.</p>
<p>We can directly write function but in some browsers it does not work so we have to run the function in below manner.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">window</span>.addEventListener(<span class="hljs-string">'DOMContentLoaded'</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'DOM fully loaded and parsed'</span>);
    getLocation();
});
</code></pre>
<h3 id="heading-5-complete-html-code-given-below">5. Complete HTML Code Given Below.</h3>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"X-UA-Compatible"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"IE=edge"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Geolocation Form<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"submit_location"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"post"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"hidden"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"latitude"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"lat"</span> <span class="hljs-attr">required</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"hidden"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"longitude"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"long"</span> <span class="hljs-attr">required</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"user_data"</span>&gt;</span>Add User Data<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"user_data"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"user_data"</span> <span class="hljs-attr">required</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit The Data<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
            <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">myFunction</span>(<span class="hljs-params"></span>) </span>{
                <span class="hljs-comment">// this will be called when my function is needed</span>
                <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'location captured'</span>);
            }

            <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getLocation</span>(<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">if</span> (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(showPosition, myFunction);
                    <span class="hljs-keyword">if</span> ((lat.getAttribute(<span class="hljs-string">'value'</span>) == <span class="hljs-literal">null</span>) || (long.getAttribute(<span class="hljs-string">'value'</span>) == <span class="hljs-literal">null</span>)) {

                        <span class="hljs-comment">// code to run if cs disagrees to share the location</span>
                        <span class="hljs-comment">// x.innerHTML = "Form Can't be uploaded Until you provide your current location";</span>
                    }

                } <span class="hljs-keyword">else</span> {

                    <span class="hljs-comment">// if client browser does not supports geolocation at all</span>
                    <span class="hljs-comment">// x.innerHTML = "Geolocation is not supported by this browser.";</span>
                }
            }

            <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">showPosition</span>(<span class="hljs-params">position</span>) </span>{
                <span class="hljs-comment">// code to run if cs agrees to share the location</span>
                <span class="hljs-comment">// x.innerHTML = "Now You Can Submit the Form";</span>
                lat.setAttribute(<span class="hljs-string">'value'</span>, position.coords.latitude);
                long.setAttribute(<span class="hljs-string">'value'</span>, position.coords.longitude);
            }

            <span class="hljs-built_in">window</span>.addEventListener(<span class="hljs-string">'DOMContentLoaded'</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
                <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'DOM fully loaded and parsed'</span>);
                getLocation();
            });
        </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h3 id="heading-6-screenshots-of-how-the-form-and-location-notification-looks-on-firefox">6. Screenshots of How The Form and location notification Looks on Firefox</h3>
<h4 id="heading-location-asked-screenshot">Location Asked Screenshot</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1661531976161/RvWE24rPH.png" alt="location asked screenshot" /></p>
<h4 id="heading-location-captured-screenshot">Location Captured Screenshot</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1661531999710/PV9tXyW2G.png" alt="location captured screenshot" /></p>
]]></content:encoded></item><item><title><![CDATA[Creating HTML Template And Views | Django CMS Building By shriekdj]]></title><description><![CDATA[In This Post I Will Create Html Pages for the site and as well as show how to use `urls.py` and `views.py`. First Create a folder named `templates` in ...]]></description><link>https://shriekdj.hashnode.dev/creating-html-template-and-views-django-cms-building-by-shriekdj</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/creating-html-template-and-views-django-cms-building-by-shriekdj</guid><category><![CDATA[Python]]></category><category><![CDATA[Django]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Tue, 23 Aug 2022 14:43:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1661263278595/AyYReCkm0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In This Post I Will Create Html Pages for the site and as well as show how to use <code>urls.py</code> and <code>views.py</code>.</p>
<p>First Create a folder named <code>templates</code> in <code>blog</code> app in django app and add update the variable in <code>django_project_name/setting.py</code> like given below</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> os <span class="hljs-comment"># add it at the top of settings.py</span>

TEMPLATES = [
    {
        <span class="hljs-string">'BACKEND'</span>: <span class="hljs-string">'django.template.backends.django.DjangoTemplates'</span>,
        <span class="hljs-string">'DIRS'</span>: [os.path.join(BASE_DIR, <span class="hljs-string">'templates'</span>)], <span class="hljs-comment"># at here add templates folder</span>
        <span class="hljs-string">'APP_DIRS'</span>: <span class="hljs-literal">True</span>,
        <span class="hljs-string">'OPTIONS'</span>: {
            <span class="hljs-string">'context_processors'</span>: [
                <span class="hljs-string">'django.template.context_processors.debug'</span>,
                <span class="hljs-string">'django.template.context_processors.request'</span>,
                <span class="hljs-string">'django.contrib.auth.context_processors.auth'</span>,
                <span class="hljs-string">'django.contrib.messages.context_processors.messages'</span>,
            ],
        },
    },
]
</code></pre>
<p>Create an <code>index.html</code> in it like given below</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"X-UA-Compatible"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"IE=edge"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Hello World<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Hello World<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>Now goto file <code>blog/views.py</code> and create a new function like below to load our <code>index.html</code> you can give whatever name you wanted.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.shortcuts <span class="hljs-keyword">import</span> render

<span class="hljs-comment"># Create your views here.</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">index</span>(<span class="hljs-params">request</span>):</span>
    <span class="hljs-keyword">return</span> render(request, <span class="hljs-string">'index.html'</span>)
</code></pre>
<p>Here we are rendering our index page with function named index. it's not mandatory to give the same name as file name but it's just helps you remember the locations. at above function we are giving parameter <code>request</code> it is for getting the data from our client browser and we as Server write logic at in this function.</p>
<p>We Also Need 2 More Steps to view this page.</p>
<p>First Create <code>urls.py</code> in <strong>blog</strong> folder and write below code.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.urls <span class="hljs-keyword">import</span> path
<span class="hljs-keyword">from</span> blog <span class="hljs-keyword">import</span> views

urlpatterns = [
    path(<span class="hljs-string">''</span>, views.index)
]
</code></pre>
<p>at here we are loading all the urls in <code>urlpatterns</code> variable and blank path means that it's at homepage of blog app.</p>
<p>And At Last At the <code>django_project/urls.py</code> we need to make some modifications. Watch Clearly Both Are same file name but different Folder. This <code>urls.py</code> is Main <code>url</code> routing file of whole site. change it like given below</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.contrib <span class="hljs-keyword">import</span> admin
<span class="hljs-keyword">from</span> django.urls <span class="hljs-keyword">import</span> include ,path

urlpatterns = [
    path(<span class="hljs-string">'admin/'</span>, admin.site.urls),
    path(<span class="hljs-string">''</span>, include(<span class="hljs-string">'blog.urls'</span>))
]
</code></pre>
<p>At here we have to Add Global Paths of Site with Special <code>include</code> function. directly adding similar to admin will not work. now load the site with <code>python ./src/manage.py runserver</code> screenshot given below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1661182367912/7_V-iMpDo.png" alt="Django's Index Page Loading Image" /></p>
<p>if you see this clearly i did not use relative import it may raises some error in production mode in future and i have to manually update all relative import to absolute import.</p>
<p>But I Will Mostly Use Class Based Views Instead of Function Based so I will Change My <code>index</code> function in `views.py as follows.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.shortcuts <span class="hljs-keyword">import</span> render
<span class="hljs-keyword">from</span> django.views <span class="hljs-keyword">import</span> View

<span class="hljs-comment"># Create your views here.</span>

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">IndexView</span>(<span class="hljs-params">View</span>):</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span>(<span class="hljs-params">self, request, *args, **kwargs</span>):</span>
        <span class="hljs-keyword">return</span> render(request, <span class="hljs-string">'index.html'</span>)
</code></pre>
<p>Here all the logic of the code get into <code>get method</code> the views class and also change <code>urlpatterns</code> under <code>blog/urls.py</code> as follows below.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.urls <span class="hljs-keyword">import</span> path
<span class="hljs-keyword">from</span> blog <span class="hljs-keyword">import</span> views

urlpatterns = [
    path(<span class="hljs-string">''</span>, views.IndexView.as_view(), name=<span class="hljs-string">'index_view'</span>),
]
</code></pre>
<p>It will not change look of the page at all <strong>as of now</strong> but in future we can use inheritance like features with it.</p>
<p>In Class <code>View</code> The <code>get</code> method means GET Request and obviously it have other <code>request methods</code> like <code>['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']</code></p>
<p>and <code>as_view()</code> method will return the response as per request method in one class.</p>
<p>Chaging View Again</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.views.generic.base <span class="hljs-keyword">import</span> TemplateView

<span class="hljs-comment"># Create your views here.</span>

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">IndexView</span>(<span class="hljs-params">TemplateView</span>):</span>

    template_name: str = <span class="hljs-string">'index.html'</span>

    <span class="hljs-comment"># def get(self, request, *args, **kwargs):</span>
    <span class="hljs-comment">#     return render(request, 'index.html')</span>
</code></pre>
<p>you can seet the code it reduced if we are returning the render function.</p>
<p>Actually views function have the specific way of returning pages like given below.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">my_view_function</span>(<span class="hljs-params">request</span>):</span>
  context_to_send_html= {<span class="hljs-string">"data sent to our template"</span>: <span class="hljs-string">"some-data"</span> }
  <span class="hljs-keyword">return</span> render(request, <span class="hljs-string">'template_file_name.html'</span>, context_to_send_html)
</code></pre>
<p>To Make It Easily Writable We Write Class Based View. as of now it look to difficult but it will save too much of our time in future.</p>
<p>As always the given below is GitHub Repository URL.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/shriekdj/shriekdj_cms">https://github.com/shriekdj/shriekdj_cms</a></div>
]]></content:encoded></item><item><title><![CDATA[Creating Custom Profile and Tag | Django CMS Building By shriekdj]]></title><description><![CDATA[In this post i will create Tag and Profile Model for the Django Blog CMS Project with new changes. Like Using Django's Own User Model for Creating Profile.]]></description><link>https://shriekdj.hashnode.dev/creating-custom-profile-and-tag-django-cms-building-by-shriekdj</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/creating-custom-profile-and-tag-django-cms-building-by-shriekdj</guid><category><![CDATA[Django]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[cms]]></category><category><![CDATA[Python]]></category><category><![CDATA[Blogging]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Mon, 22 Aug 2022 14:32:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1661178546952/Nm3OxUh6S.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So Now I am Trying to Create 2 New Models for the CMS Which Are User Profile and Blog Tags but before That I Want to Say Some Reconfiguration Made By In The GitHub Repository During The Series.</p>
<p>I Just Renamed The Django Project from <code>dj_admin</code> to <code>config</code> because that should be correct to understand and run the project and Also I removed The <code>save()</code> method of the <code>Post Model</code>, <code>slug</code> field of the <code>Post Model</code> and <code>random_words()</code> function because it was creating some errors while migrating the project.</p>
<p>So Now The <code>Post Model</code> of the Django Looks Like This Now</p>
<pre><code class="lang-python"><span class="hljs-comment"># Create your models here.</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    id = models.BigAutoField(primary_key=<span class="hljs-literal">True</span>)
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
    created_at = models.DateTimeField(verbose_name=<span class="hljs-string">'created_at'</span>,auto_now=<span class="hljs-literal">True</span>, auto_created=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">False</span>)
    published_at = models.DateTimeField(verbose_name=<span class="hljs-string">'published_at'</span>,null=<span class="hljs-literal">True</span>)
    updated_at = models.DateTimeField(verbose_name=<span class="hljs-string">'updated_at'</span>,null=<span class="hljs-literal">True</span>)
    slug = models.SlugField(verbose_name=<span class="hljs-string">'slug'</span>, max_length=<span class="hljs-number">50</span>, unique=<span class="hljs-literal">True</span>)
</code></pre>
<p>After Creating The Blog Post Model We Should Need an Author / User Profile Model is Needed and Know That This Model Should Be Upside of the Post Model.</p>
<p>For Creating the User Profile We will import Auth User Model of the Django With <code>one-to-one</code> field for using in our blog write below code Upside of the <code>Post Model</code>.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.conf <span class="hljs-keyword">import</span> settings
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Profile</span>(<span class="hljs-params">models.Model</span>):</span>
    user = models.OneToOneField(
        settings.AUTH_USER_MODEL,
        on_delete=models.PROTECT,
    )
    website = models.URLField(blank=<span class="hljs-literal">True</span>)
    bio = models.CharField(max_length=<span class="hljs-number">240</span>, blank=<span class="hljs-literal">True</span>)

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__str__</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.user.get_username()
</code></pre>
<p>Here I added <code>on_delete=models.PROTECT</code> to prevent deletion of the Profile.</p>
<p>Also Added <code>Tag Model</code> To the <code>blog</code> App between <code>Profile Model</code> and <code>Post Model</code>.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Tag</span>(<span class="hljs-params">models.Model</span>):</span>
    name = models.CharField(max_length=<span class="hljs-number">50</span>, unique=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>)
    slug = models.SlugField(verbose_name=<span class="hljs-string">'slug'</span>, max_length=<span class="hljs-number">50</span>, unique=<span class="hljs-literal">True</span>)

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__str__</span>(<span class="hljs-params">self</span>) -&gt; str:</span>
        <span class="hljs-keyword">return</span> self.name
</code></pre>
<p>I Also Added Some New Fields to the <code>Post Model</code> named as <code>subtitle</code>, <code>meta_description</code>, <code>is_published</code> as well as added <code>author</code> as <code>Foreign-Key</code> ( we consider only one author to an post ) and <code>tags</code> as <code>Many to Many</code> Because Many Post Can Have Tags And Vice Versa.</p>
<p>After Updating the Post Model It Looks Like Given Below</p>
<pre><code class="lang-python"><span class="hljs-comment"># Create your models here.</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    id = models.BigAutoField(primary_key=<span class="hljs-literal">True</span>)
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    subtitle = models.CharField(max_length=<span class="hljs-number">255</span>, blank=<span class="hljs-literal">True</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
    meta_description = models.CharField(max_length=<span class="hljs-number">150</span>, blank=<span class="hljs-literal">True</span>)
    created_at = models.DateTimeField(verbose_name=<span class="hljs-string">'created_at'</span>,auto_now=<span class="hljs-literal">True</span>, auto_created=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">False</span>)
    updated_at = models.DateTimeField(verbose_name=<span class="hljs-string">'updated_at'</span>,null=<span class="hljs-literal">True</span>)
    published_at = models.DateTimeField(verbose_name=<span class="hljs-string">'published_at'</span>,null=<span class="hljs-literal">True</span>, blank=<span class="hljs-literal">True</span>)
    is_published = models.BooleanField(verbose_name=<span class="hljs-string">'is_published'</span>, default=<span class="hljs-literal">False</span>)
    slug = models.SlugField(verbose_name=<span class="hljs-string">'slug'</span>, max_length=<span class="hljs-number">50</span>, unique=<span class="hljs-literal">True</span>)

    author = models.ForeignKey(Profile, on_delete=models.PROTECT, default=<span class="hljs-literal">None</span>)
    tags = models.ManyToManyField(Tag, blank=<span class="hljs-literal">True</span>)
</code></pre>
<p>We Also Need to Update <code>admin.py</code> in blog to like given below.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.contrib <span class="hljs-keyword">import</span> admin

<span class="hljs-comment"># Register your models here.</span>
<span class="hljs-keyword">from</span> blog.models <span class="hljs-keyword">import</span> Profile, Post, Tag

<span class="hljs-meta">@admin.register(Profile)</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ProfileAdmin</span>(<span class="hljs-params">admin.ModelAdmin</span>):</span>
    model = Profile

<span class="hljs-meta">@admin.register(Tag)</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TagAdmin</span>(<span class="hljs-params">admin.ModelAdmin</span>):</span>
    model = Tag

<span class="hljs-meta">@admin.register(Post)</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">PostAdmin</span>(<span class="hljs-params">admin.ModelAdmin</span>):</span>
    model = Post

    list_display = (
        <span class="hljs-string">"id"</span>,
        <span class="hljs-string">"title"</span>,
        <span class="hljs-string">"subtitle"</span>,
        <span class="hljs-string">"slug"</span>,
        <span class="hljs-string">"published_at"</span>,
        <span class="hljs-string">"is_published"</span>,
    )
    list_filter = (
        <span class="hljs-string">"is_published"</span>,
        <span class="hljs-string">"published_at"</span>,
    )
    list_editable = (
        <span class="hljs-string">"title"</span>,
        <span class="hljs-string">"subtitle"</span>,
        <span class="hljs-string">"slug"</span>,
        <span class="hljs-string">"published_at"</span>,
        <span class="hljs-string">"is_published"</span>,
    )
    search_fields = (
        <span class="hljs-string">"title"</span>,
        <span class="hljs-string">"subtitle"</span>,
        <span class="hljs-string">"slug"</span>,
        <span class="hljs-string">"body"</span>,
    )
    prepopulated_fields = {
        <span class="hljs-string">"slug"</span>: (
            <span class="hljs-string">"title"</span>,
            <span class="hljs-string">"subtitle"</span>,
        )
    }
    date_hierarchy = <span class="hljs-string">"published_at"</span>
    save_on_top = <span class="hljs-literal">True</span>
</code></pre>
<p>Also Screenshot Below of the add post in admin panel</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1661178286716/twvyeRP63.png" alt="Screenshot 2022-08-17 at 21-25-36 Add post Django site admin.png" /></p>
<p>Here is Below Link to My GitHub Repo</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/shriekdj/shriekdj_cms">https://github.com/shriekdj/shriekdj_cms</a></div>
]]></content:encoded></item><item><title><![CDATA[Customizing Slug Field for Post Model | Django CMS Building By shriekdj]]></title><description><![CDATA[So In Previous Post I Created The Simple Django Model of the `BlogPost` Which Stores Data Like Given Below.]]></description><link>https://shriekdj.hashnode.dev/customizing-slug-field-for-post-model-django-cms-building-by-shriekdj</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/customizing-slug-field-for-post-model-django-cms-building-by-shriekdj</guid><category><![CDATA[Django]]></category><category><![CDATA[cms]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[Slug ]]></category><category><![CDATA[Python]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Sat, 13 Aug 2022 11:29:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1660379564173/Tk7mN7Iw_.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So In Previous Post I Created The Simple Django Model of the <code>BlogPost</code> Which Stores Data Like Given Below.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
    created_on = models.DateTimeField(auto_now=<span class="hljs-literal">True</span>, auto_created=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">False</span>)
    published_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
    updated_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
</code></pre>
<p>But It does Not have any slug field so I am Adding them it will be like given below</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> Iterable, Optional
<span class="hljs-keyword">from</span> django.db <span class="hljs-keyword">import</span> models

<span class="hljs-comment"># Create your models here.</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
    created_on = models.DateTimeField(auto_now=<span class="hljs-literal">True</span>, auto_created=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">False</span>)
    published_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
    updated_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
    slug = models.SlugField(verbose_name=<span class="hljs-string">'slug'</span>, max_length=<span class="hljs-number">255</span>, unique=<span class="hljs-literal">True</span>)

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">save</span>(<span class="hljs-params">self, force_insert: bool = ..., force_update: bool = ..., using: Optional[str] = ..., update_fields: Optional[Iterable[str]] = ...</span>) -&gt; <span class="hljs-keyword">None</span>:</span>
        <span class="hljs-keyword">return</span> super().save(force_insert, force_update, using, update_fields)
</code></pre>
<p>Here there is also a new method is added here. don't worry you don't have to remember it as it is just type <code>def save</code> under the model in your code editor and it auto fill the <code>save()</code> method of <code>models.Model</code> Base Class Also <code>from typing import Iterable, Optional</code> for working with optional values.</p>
<p>There is Function Named <code>slugify()</code> in Built-in module of django <code>django.utils.text</code> just import it and modify the last one save() method like given below.</p>
<pre><code class="lang-python">    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">save</span>(<span class="hljs-params">self, *args, **kwargs</span>):</span>
        <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> self.slug:
            self.slug = slugify(self.title)
        super(Post, self).save(*args, **kwargs)
</code></pre>
<p>Now This may make our slug easily but it will have issues like we can't create Posts with same title so we will add new function here.</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> random
<span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> Iterable, Optional
<span class="hljs-keyword">from</span> django.db <span class="hljs-keyword">import</span> models
<span class="hljs-keyword">from</span> django.utils.text <span class="hljs-keyword">import</span> slugify

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">random_words</span>():</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">''</span>.join(random.choice(<span class="hljs-string">'abcdefghijklmnopqrstuvwxyz0123456789'</span>.split(<span class="hljs-string">''</span>)) <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(<span class="hljs-number">6</span>))

<span class="hljs-comment"># Create your models here.</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
    created_on = models.DateTimeField(auto_now=<span class="hljs-literal">True</span>, auto_created=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">False</span>)
    published_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
    updated_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
    slug = models.SlugField(verbose_name=<span class="hljs-string">'slug'</span>, max_length=<span class="hljs-number">255</span>, unique=<span class="hljs-literal">True</span>)

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">save</span>(<span class="hljs-params">self, *args, **kwargs</span>):</span>
        <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> self.slug:
            self.slug = slugify(self.title + random_words())
        super(Post, self).save(*args, **kwargs)
</code></pre>
<p>here we added random module and <code>random_words()</code> functions for auto creating slug if not informed.</p>
<p>Also register that model in <code>admin.py</code> of the <code>blog</code> app folder like given below</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.contrib <span class="hljs-keyword">import</span> admin

<span class="hljs-comment"># Register your models here.</span>
<span class="hljs-keyword">from</span> .models <span class="hljs-keyword">import</span> Post

admin.site.register(Post)
</code></pre>
<p>Resultant Creation Form Will Look Like Given Below After migrating the Database.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1660390049541/MJKRRNa5j.png" alt="Screenshot 2022-08-13 at 16-57-09 Post object (1) Change post Django site admin.png" /></p>
<p>Link to the Repo</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/shriekdj/shriekdj_cms">https://github.com/shriekdj/shriekdj_cms</a></div>
<hr />
<h2 id="heading-conclusion">Conclusion</h2>
<p>If you found this useful then please share this and follow me! Also check out Buy Me A Coffee if you want to support me on a new level!</p>
<p><a target="_blank" href="https://www.buymeacoffee.com/shriekdj"><img src="https://cdn.buymeacoffee.com/buttons/default-yellow.png" alt="Buy me a coffee" /></a></p>
]]></content:encoded></item><item><title><![CDATA[Creating Custom CMS In Django | Django CMS Building By shriekdj]]></title><description><![CDATA[So I Thought about creating the Custom CMS and Update it's feature day by day as per need. For Example Firstly I just added blog app in django project name]]></description><link>https://shriekdj.hashnode.dev/creating-custom-cms-in-django-django-cms-building-by-shriekdj</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/creating-custom-cms-in-django-django-cms-building-by-shriekdj</guid><category><![CDATA[Python]]></category><category><![CDATA[Django]]></category><category><![CDATA[blog]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[cms]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Wed, 10 Aug 2022 11:07:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1660129297542/Lsu-A-Hhj.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So I Thought about creating the Custom CMS and Update it's feature day by day as per need.</p>
<p>For Example Firstly I just added <code>blog</code> app in django project named <code>dj_admin</code>.
And Created Very Simple Model LIke</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.db <span class="hljs-keyword">import</span> models

<span class="hljs-comment"># Create your models here.</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
</code></pre>
<p>after some time I added 3 fields like <code>created_at</code>, <code>published_at</code> and <code>updated_at</code> where <code>created_at</code> is mandatory and auto created Model Then updated like this.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.db <span class="hljs-keyword">import</span> models

<span class="hljs-comment"># Create your models here.</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span>(<span class="hljs-params">models.Model</span>):</span>
    title = models.CharField(verbose_name=<span class="hljs-string">'title'</span>, max_length=<span class="hljs-number">255</span>, null=<span class="hljs-literal">False</span>)
    content = models.TextField(verbose_name=<span class="hljs-string">'content'</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">True</span>)
    created_on = models.DateTimeField(auto_now=<span class="hljs-literal">True</span>, auto_created=<span class="hljs-literal">True</span>, null=<span class="hljs-literal">False</span>, blank=<span class="hljs-literal">False</span>)
    published_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
    updated_on = models.DateTimeField(null=<span class="hljs-literal">True</span>)
</code></pre>
<p>I Created The GitHub Repo for the Project And It's Django Project Code Will Be Under <code>src</code> directory.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/shriekdj/shriekdj_cms">https://github.com/shriekdj/shriekdj_cms</a></div>
<p>I will be adding features to it day by day to make it blog.</p>
]]></content:encoded></item><item><title><![CDATA[I Published the Python Package on PyPi : pip install google-address-to-latlong-csv]]></title><description><![CDATA[So today I Published an python package first time in my life. Now This is a Python 3 Package which gets the list of data of addresses from an csv file and…]]></description><link>https://shriekdj.hashnode.dev/i-published-the-python-package-on-pypi-pip-install-google-address-to-latlong-csv</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/i-published-the-python-package-on-pypi-pip-install-google-address-to-latlong-csv</guid><category><![CDATA[pypi]]></category><category><![CDATA[Python]]></category><category><![CDATA[shriekdj]]></category><category><![CDATA[geocoding]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Thu, 30 Jun 2022 13:59:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1660041914007/ki5J0AWAe.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So today I Published an python package first time in my life.</p>
<p>Now This is a Python 3 Package which gets the list of data of addresses from an csv file and gives an output as csv with additional fields of latitude and longitude of the address provided by google GeoCoding API.</p>
<p>I Created this Package With very simple program of Poetry.</p>
<p>So Now <code>Poetry</code> is an Virtual Environment Manager Just Like Pipenv or Virtual Env But with It's Own Way of creating wheel for our Project and also it helps us to publish the package.</p>
<p>How to Publish a Python package with help of poetry</p>
<ul>
<li>Make your project in a folder with <code>__init__.py</code> file and goto parent of that <strong>package_name_folder</strong></li>
<li>run <code>poetry build</code></li>
<li>run <code>poetry publish</code></li>
<li>It will ask credentials of pypi.org so fill it and your package published</li>
</ul>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/shriekdj/google_address_to_latlong_csv">https://github.com/shriekdj/google_address_to_latlong_csv</a></div>
<p>you can install the package by running</p>
<pre><code class="lang-python">pip install google-address-to-latlong-csv
</code></pre>
<p><a target="_blank" href="https://pypi.org/project/google-address-to-latlong-csv/">pip install google-address-to-latlong-csv</a></p>
<p>I Know I Am writing this post after too much time, because i actually didn't have that many article topics so i just didn't published some unnecessary stuffs. But I Have Now some topics to cover so just wait for it.</p>
<p>Thanks bye, 👋</p>
]]></content:encoded></item><item><title><![CDATA[Creating an Website or Webapp in Django Web Framework]]></title><description><![CDATA[Django tutorials by shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/creating-an-website-or-webapp-in-django-web-framework</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/creating-an-website-or-webapp-in-django-web-framework</guid><category><![CDATA[THW Web Apps]]></category><category><![CDATA[Python]]></category><category><![CDATA[Django]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Tue, 19 Apr 2022 12:58:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1650372273197/e7g1RtIlq.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-preface">Preface</h2>
<p>This Post Will Be Part of <a target="_blank" href="https://townhall.hashnode.com/the-epic-hashnode-writeathon">Hashnode's Writeathon</a> and also part of My Django Related Posts.</p>
<p>So there are many ways to write Back-end for an Web App or Website but we can also write an Web App with Python 3 Programming Language and Django Is One of them.</p>
<p>It's an Free and Open-source Project Created by Django Project Foundation.</p>
<hr />
<h2 id="heading-creating-an-development-environment-for-running-a-django-project">Creating An Development Environment for running a Django Project</h2>
<p>For Running an Django Project We Will Need Some Prerequisites like In Our Operating System We Need Python 3.8 or Above Installed.</p>
<h3 id="heading-installing-python-venv">Installing <code>python-venv</code></h3>
<p>Mostly the venv module of python is already installed but it's not installed in Most Cases.</p>
<p>So We Can Install the venv module by our system package-manager.</p>
<p>Like Below is for Ubuntu</p>
<pre><code class="lang-bash">sudo apt-get install python-venv
</code></pre>
<p>And For Windows it Is installed with Python Exe.</p>
<h3 id="heading-creating-the-virtual-environment">Creating the Virtual Environment</h3>
<p>The given below code will create an virtual environment in new directory named <code>venv</code></p>
<pre><code class="lang-bash"><span class="hljs-comment"># if only python3 is on system</span>
python -m venv venv

<span class="hljs-comment"># if multiple python versions are installed on system</span>
python3 -m venv venv
</code></pre>
<h3 id="heading-activating-the-python-virtual-environment">Activating the Python Virtual Environment</h3>
<p>Given Below is an Chart about how to activate an virtual environment in that Operating System.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Platform</td><td>Shell</td><td>Command to activate virtual environment</td></tr>
</thead>
<tbody>
<tr>
<td>POSIX</td><td>bash/zsh</td><td><code>$ source &lt;venv&gt;/bin/activate</code></td></tr>
<tr>
<td></td><td>fish</td><td><code>$ source &lt;venv&gt;/bin/activate.fish</code></td></tr>
<tr>
<td></td><td>csh/tcsh</td><td><code>$ source &lt;venv&gt;/bin/activate.csh</code></td></tr>
<tr>
<td></td><td>PowerShell Core</td><td><code>$ &lt;venv&gt;/bin/Activate.ps1</code></td></tr>
<tr>
<td>Windows</td><td>cmd.exe</td><td><code>C:\&gt; &lt;venv&gt;\Scripts\activate.bat</code></td></tr>
<tr>
<td></td><td>PowerShell</td><td><code>PS C:\&gt; &lt;venv&gt;\Scripts\Activate.ps1</code></td></tr>
</tbody>
</table>
</div><hr />
<h2 id="heading-installing-django">Installing Django</h2>
<p> You Can Simply install Django In your vitual environment by running below any pip command.</p>
<pre><code class="lang-python">python3 -m pip install Django

<span class="hljs-comment"># or just python</span>
python -m venv pip install Django

<span class="hljs-comment"># Directly pip or pip3</span>

pip install Django
pip3 install Django
</code></pre>
<p>It will also install automatically an package named <code>django-admin</code> in our virtualenv.</p>
<hr />
<h2 id="heading-creating-and-starting-first-project-in-django">Creating and Starting First Project In Django</h2>
<p>Open Your Command Shell with virtual environment and Run Below Command.</p>
<h3 id="heading-for-creating-project-under-new-folder-of-current-folder-named-djangoproject">For Creating Project Under New Folder of current folder Named <code>django_project</code></h3>
<pre><code class="lang-bash">django-admin startproject django_project
</code></pre>
<p>This Will Create an Folder Structure Below.</p>
<blockquote>
<p>current_folder/</p>
<blockquote>
<p>django_project/</p>
<blockquote>
<p>django_project/</p>
<blockquote>
<p>__init__.py</p>
<p>asgi.py</p>
<p>settings.py</p>
<p>urls.py</p>
<p>views.py</p>
<p>wsgi.py</p>
</blockquote>
<p>manage.py</p>
</blockquote>
</blockquote>
</blockquote>
<p>Whenever you create an django project be aware it rejects the project name with <code>-</code> hyphen symbols so use <code>_</code> instead.</p>
<h3 id="heading-for-creating-project-directly-under-current-directory">For Creating Project Directly under Current Directory</h3>
<pre><code class="lang-bash">django-admin startproject django_project .
</code></pre>
<p>We add an extra argument of path where to create project, here <code>.</code> dot symbol is used for current directory of relative path.</p>
<p>It will create an different folder structure like given below.</p>
<blockquote>
<p>current_folder/</p>
<blockquote>
<p>django_project/</p>
<blockquote>
<p>__init__.py</p>
<p>asgi.py</p>
<p>settings.py</p>
<p>urls.py</p>
<p>views.py</p>
<p>wsgi.py</p>
</blockquote>
<p>manage.py</p>
</blockquote>
</blockquote>
<hr />
<h2 id="heading-running-django-server-on-localhost">Running Django Server on Localhost</h2>
<p>Now we can run our django project directly with given below command, but be aware this command are for development environment only.</p>
<pre><code class="lang-bash">python manage.py runserver
</code></pre>
<p>Given command will runserver and you just have to open <a target="_blank" href="http://localhost:8000">http://localhost:8000</a> or <a target="_blank" href="http://127.0.0.1:8000">http://127.0.0.1:8000</a> on your browser.</p>
<p>Given Below is an image of the Django Project Running.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1650372273197/e7g1RtIlq.png" alt="First time Django Project Running" /></p>
<hr />
<h2 id="heading-if-any-issues-occured-check-out-this-posts">If any issues occured check out this posts.</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://shriekdj.hashnode.dev/how-to-create-and-activate-the-virtual-environment-for-python3-project">https://shriekdj.hashnode.dev/how-to-create-and-activate-the-virtual-environment-for-python3-project</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://shriekdj.hashnode.dev/python-venv-or-virtualenv-wont-activate-on-windows">https://shriekdj.hashnode.dev/python-venv-or-virtualenv-wont-activate-on-windows</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://shriekdj.hashnode.dev/unable-to-login-django-admin-after-update-giving-error-forbidden-403-csrf-verification-failed-request-aborted">https://shriekdj.hashnode.dev/unable-to-login-django-admin-after-update-giving-error-forbidden-403-csrf-verification-failed-request-aborted</a></div>
<hr />
<h2 id="heading-conclusion">Conclusion</h2>
<p>If you found this useful then please share this and follow me! Also check out Buy Me A Coffee if you want to support me on a new level!</p>
<p><a target="_blank" href="https://www.buymeacoffee.com/shriekdj"><img src="https://cdn.buymeacoffee.com/buttons/default-yellow.png" alt="Buy me a coffee" /></a></p>
<p>Thanks for reading untill now.</p>
<p>Bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[PHP Related Small Tips for Improving the Speed of Writing Program]]></title><description><![CDATA[PHP Tutorials by shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/php-related-small-tips-for-improving-the-speed-of-writing-program</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/php-related-small-tips-for-improving-the-speed-of-writing-program</guid><category><![CDATA[PHP]]></category><category><![CDATA[PHP7]]></category><category><![CDATA[PHPUnit]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Mon, 18 Apr 2022 15:19:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/2Rd-hwT2xQ0/upload/v1650295048472/Y02yJeNrl.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-preface">Preface</h2>
<p>In this article you will learn about the shortcuts and things to notice while writing PHP Code</p>
<p>Also PHP Should Be Already Installed on your PC, Device, Server, Sandbox or Virtual Machine ( Whatever You are using Maybe Toaster Also 😅 Don't Know What will Be Machine ).</p>
<blockquote>
<p>The Given Post is about PHP 8 and Above.</p>
</blockquote>
<p>PHP Code is created under an HTML Template. Actually PHP is Used like additional element of HTML.</p>
<h2 id="heading-php-oneliner-echo-function-shortcut">PHP Oneliner echo Function Shortcut</h2>
<p>So while writing some code like <code>&lt;?php echo "Hello World" ?&gt;</code> oneliner code we can use shortcut like below.</p>
<pre><code class="lang-php">&lt;div&gt;
This PHP One Line Code
<span class="hljs-meta">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-string">"Hello World"</span> <span class="hljs-meta">?&gt;</span>

<span class="hljs-keyword">And</span> This One Line PHP Code are similar.
<span class="hljs-meta">&lt;?=</span> <span class="hljs-string">"Hello World"</span> <span class="hljs-meta">?&gt;</span>
<span class="hljs-keyword">and</span> Also Shows the same result
&lt;/div&gt;
</code></pre>
<p>This shortcut is only for echo function not for any other functions.</p>
<hr />
<h2 id="heading-php-running-as-alone">PHP running as alone</h2>
<p>Just if your learning only the PHP, then for starters there is no need of installing or using apache, mysql, phpmyadmin directly from start you can still learn starting concepts without them.</p>
<p>Given Below is the Command for starting Built-in server of php in Command-line is given below.</p>
<pre><code class="lang-php">php index.php -S <span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">8000</span> -t .
</code></pre>
<p>For Online Code Editor Ide It is <code>0.0.0.0:8000</code> for using instead of <code>localhost:8000</code>.</p>
<hr />
<h2 id="heading-while-ending-the-php-file-no-need-to-add-last-andgt-in-some-situations">While ending the PHP File No Need to add last <code>?&gt;</code> in some Situations</h2>
<p>If your code does not have any data related to html after the PHP Closing Tag At Last then also don't add the <code>?&gt;</code> tag of php.</p>
<p>Reason Maybe Like you maybe not always maybe you will have issues while importing one php file with <code>?&gt;</code> at to another then the another php file will expect no end tag at last of php.</p>
<p>For Example Given Below.</p>
<h3 id="heading-firstphp">first.php</h3>
<pre><code class="lang-php"><span class="hljs-meta">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-string">"Hello World"</span> <span class="hljs-meta">?&gt;</span>
</code></pre>
<p>if we tried to import this file in another file like given below</p>
<h3 id="heading-otherphp">other.php</h3>
<pre><code class="lang-php">&lt;div&gt;
<span class="hljs-meta">&lt;?php</span>
<span class="hljs-keyword">require_once</span>(<span class="hljs-string">"./first.php"</span>);

<span class="hljs-keyword">echo</span> <span class="hljs-string">"This part will not parse as php code"</span>;
<span class="hljs-meta">?&gt;</span>
<span class="hljs-keyword">And</span> In Some OS it shows errors
</code></pre>
<p>here when we import <code>first.php</code> our php code part of <code>second.php</code> will close while importing and program below that will have some issues while running.</p>
<hr />
<h2 id="heading-conclusion">Conclusion</h2>
<p>If you found this useful then please share this and follow me! Also check out Buy Me A Coffee if you want to support me on a new level!</p>
<p><a target="_blank" href="https://www.buymeacoffee.com/shriekdj"><img src="https://cdn.buymeacoffee.com/buttons/default-yellow.png" alt="Buy me a coffee" /></a></p>
<hr />
<h2 id="heading-cover-image-credits">Cover Image Credits</h2>
<p>The Given Image is Provided by <a target="_blank" href="https://unsplash.com/@benofthenorth">Ben Griffiths</a> on <a target="_blank" href="https://unsplash.com">Unsplash</a>.</p>
<p>Image Available at <a target="_blank" href="https://unsplash.com/photos/2Rd-hwT2xQ0">https://unsplash.com/photos/2Rd-hwT2xQ0</a></p>
<p>Thanks for reading untill now.</p>
<p>Bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[How to Start writing Python 3 Program]]></title><description><![CDATA[Python tutorials by shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/how-to-start-writing-python-3-program</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/how-to-start-writing-python-3-program</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Developer]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Fri, 15 Apr 2022 10:53:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1650018078383/fMT2Jl6EP.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Now this post is about how you can write programs in <strong>python 3 programming language</strong>.</p>
<p>The Information will be provided in this with an <strong>Hello World Program In Python</strong>.</p>
<hr />
<h2 id="heading-hello-world-program-in-python-terminal">Hello World Program in Python Terminal</h2>
<p>To Start an Python Terminal You Can Just Open <code>python.exe</code> from start menu of windows or just write <code>python</code> in Command Line Shell Like Command-prompt, Powershell, Git Bash or Terminal of Microsoft Windows Operating System.</p>
<p>For Linux or Mac OS the Command Is Same but sometime they comes with <code>python2</code> installed already so for correct python running try <code>python3</code> command instead of <code>python</code> if it does not work.</p>
<p>Given Below is Program we are gonna write <code>print("Hello World")</code> for displaying Hello World.</p>
<pre><code class="lang-bash">$ python
Python 3.10 (default, June 4 2019, 09:25:04)
[GCC 4.8.2] on linux
Type <span class="hljs-string">"help"</span>, <span class="hljs-string">"copyright"</span>, <span class="hljs-string">"credits"</span> or <span class="hljs-string">"license"</span> <span class="hljs-keyword">for</span> more information.
&gt;&gt;&gt;<span class="hljs-built_in">print</span>(<span class="hljs-string">"Hello World"</span>)

Hello World
</code></pre>
<p>Unlike othet language it does not need any semicolon at last and neither the <code>main</code> function is mandatory everywhere.</p>
<hr />
<h2 id="heading-hello-world-program-in-python-file">Hello World Program In Python File</h2>
<p>For Running python Program from File just create an text file named <code>main.py</code> with python program in it, Here we will write <code>print("Hello World")</code> In It.</p>
<p>and for running the program just run given below commands.</p>
<pre><code class="lang-bash">$ python main.py
Hello World
</code></pre>
<p>There are some additional configuration for file also like for making the python program file as executable and able to run under Operating Systems Like Mac OS We Can Do Below Steps.</p>
<p>By Default the python encodes the Python Text files in utf-8 encoding which you can change if wanted just add <code># -*- coding: encoding_name -*-</code> at start of file and also need to add an <code>Unix shebang line</code> (<code>#!/usr/bin/env python3.9</code>) before that for running as executable python script if any issue occurred.</p>
<p>Like New file Will Look Like Below</p>
<pre><code class="lang-python"><span class="hljs-comment">#!/usr/bin/env python3.9</span>
<span class="hljs-comment"># -*- coding: utf-8 -*-</span>
print(<span class="hljs-string">"Hello World"</span>)
</code></pre>
<p>and also before running the file change permissions of file with commands <code>chmod +x main.py</code>.</p>
<hr />
<p>I Know I Maybe Wrote too Much thing for an Hello World Program of Python But Most of the Given Details I Found on <a target="_blank" href="https://docs.python.org/3/tutorial/interpreter.html">https://docs.python.org/3/tutorial/interpreter.html</a></p>
<p>Thanks for reading until here.</p>
<p>Bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[How to Download Python 3 On Windows Without any Incorrect Version]]></title><description><![CDATA[Python tutorials by shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/how-to-download-python-3-on-windows-without-any-incorrect-version</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/how-to-download-python-3-on-windows-without-any-incorrect-version</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Windows]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Thu, 14 Apr 2022 15:02:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1649945636873/pPQCY_ro5.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So This is Start of the Series Python tutorials by shriekdj.</p>
<p>So Most of the Time this process is very simple to follow just go to website <a target="_blank" href="https://python.org">https://python.org</a> click download button to get python.</p>
<p>but there may be some problems occure in this process.</p>
<h2 id="heading-direct-method-of-downloading-python-from-there-website">Direct Method of Downloading Python From there Website</h2>
<p>As per my case I was.trying to install python3 on my college computer which had Windows 10 Educational On It and gone to python.org's download page which looks like below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1649946062597/fMf_kH1KX.png" alt="python.org python download page.png" /></p>
<p>Here I Just clicked download button and try to install EXE but it was not able to download.</p>
<blockquote>
<p>The reason was that my college computer was <strong>64-Bit</strong> the download button is configured for 32-bit Version.</p>
</blockquote>
<hr />
<p>Now Even if the that exe was 32 bit it should be run on 64-bit but still the errors are there. then actual location of the python 64 bit exe was at given address in below image.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1649946375031/F0Y2cy-LY.jpeg" alt="Location for python download exe for 64 bit" /></p>
<p>After this the process of installing it same as all other apps just Click <code>agree</code>, <code>continue</code> and <code>next</code> whatever available and Be Aware to Select an Checkbox Name <strong>Add to Path</strong> as checked.</p>
<p>Because it helps you run python code from anywhere in the system from command line also, Otherwise you will have issues for running python programs.</p>
<p>Like if you want to run file named <code>main.py</code> then the command <code>python main.py</code> will not work you have to specify your <code>python.exe</code> location with the command like given below.</p>
<pre><code class="lang-python"><span class="hljs-comment"># Command If python is added to PATH</span>
python main.py
<span class="hljs-comment"># or </span>
python3 main.py

<span class="hljs-comment"># Command if python is not added to PATH</span>

C:\python/bin/python.exe ./main.py
</code></pre>
<p>And Obviously you don't want to something like that</p>
<blockquote>
<p>Be Aware of the Current Latest Python Versions are Python3.8, Python3.9 and Python3.10 And Does Not Bing Released for deprecated os Windows 7 and Below.</p>
<blockquote>
<p>But You Can Build the Python From There GitHub Repo By Reading there Installation docs, Given Below is GitHub Repo of Cpython.</p>
</blockquote>
</blockquote>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/python/cpython">https://github.com/python/cpython</a></div>
<hr />
<h2 id="heading-downloading-python-from-windows-app-store">Downloading Python From Windows App Store</h2>
<p>It is the easiest way to download and install python from there own app store which available for free to download.</p>
<p>Just be aware to install Python3 not Python2.</p>
<p>I Will Suggest Installing Other Terminal like <code>Windows Terminal</code> or <code>Git Bash Shell</code> which are easy to use and less error prone.</p>
<p>for example the built-in command-line tools are to non user friendly for programmer and I am Saying from my experience.</p>
<hr />
<h2 id="heading-installing-python-from-packages-managers-built-for-windows-operating-system">Installing Python From Packages Managers Built for Windows Operating System</h2>
<p>Now In This decade some devs out there builted some package managers for windows operating system which is similar to linux or mac os command-line package manager.</p>
<p>Some of them are given below</p>
<ul>
<li><a target="_blank" href="https://chocolatey.org/">Chocolatey Package Manager</a> : The Third Party Package Manager. You Can also install things like <code>Visual C Runtime</code>, <code>Python</code>, <code>NodeJS</code> and Many More.</li>
<li><a target="_blank" href="https://github.com/microsoft/winget-cli">Winget Package Manager by Microsoft</a> : So this is an Package Manager build by Microsoft themselves, I do not have any Experience with using it but you can try and give your opinions in comments and also the link is of github repo not download link.</li>
</ul>
<p>Thanks for taking time the time to reading the post until here.</p>
<p>Give any reactions for giving my content algorithm boost.</p>
<p>Bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[Python tutorials by shriekdj series announcement]]></title><description><![CDATA[Python tutorials by shriekdj series]]></description><link>https://shriekdj.hashnode.dev/python-tutorials-by-shriekdj-series-announcement</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/python-tutorials-by-shriekdj-series-announcement</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[DevBlogging]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Wed, 13 Apr 2022 11:57:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1649851151029/9xaDZjjLF.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So I Was Planning on Creating Blog Series on Python Tutorials Which Involves some details About How to Install Python Or Build Python From Source and Many more like issues and explaination.</p>
<p>This also include things like uploading some codes and how to build some programs and tips related to migrating other programming language to python.</p>
<p>Thanks bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[Unable to Login Django Admin after Update : Giving Error Forbidden (403) CSRF verification failed. Request aborted.]]></title><description><![CDATA[Python-Solutions-by-shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/unable-to-login-django-admin-after-update-giving-error-forbidden-403-csrf-verification-failed-request-aborted</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/unable-to-login-django-admin-after-update-giving-error-forbidden-403-csrf-verification-failed-request-aborted</guid><category><![CDATA[Python]]></category><category><![CDATA[Django]]></category><category><![CDATA[problem solving skills]]></category><category><![CDATA[admin]]></category><category><![CDATA[Python 3]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Tue, 12 Apr 2022 12:28:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1649782613096/NSEpXPi4t.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-problem">Problem</h2>
<blockquote>
<p>Unable to Login Django Admin after Update : Giving Error Forbidden (403) CSRF verification failed. Request aborted.</p>
<blockquote>
<p>This Issue Can happened suddenly after updating to Newer Version Of Django which looks like below image..</p>
</blockquote>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1649782584873/tAsK2WZrt.JPG" alt="Forbidden (403) CSRF verification failed. Request aborted error image" /></p>
<hr />
<h2 id="heading-details">Details</h2>
<blockquote>
<p>Django Project Foundation team made some changes in security requirements for all Django Version 4.0 and Above. In Which they made mandatory to create an list of urls getting any type of form upload or POST request in project settings named as <strong>CSRF_TRUSTED_ORIGINS</strong>.</p>
<blockquote>
<p> They did not updated the details in latest tutorial documentation but they published the Changes Notes at <a target="_blank" href="https://docs.djangoproject.com/en/4.0/releases/4.0/#csrf-trusted-origins-changes-4-0">https://docs.djangoproject.com/en/4.0/releases/4.0/#csrf-trusted-origins-changes-4-0</a>.</p>
</blockquote>
</blockquote>
<hr />
<h2 id="heading-first-solution">First Solution</h2>
<blockquote>
<p>For <code>localhost</code> or <code>127.0.0.1</code>.</p>
<blockquote>
<p>Goto <code>settings.py</code> of your django project and create a new list of urls at last like given below</p>
</blockquote>
</blockquote>
<pre><code class="lang-python">CSRF_TRUSTED_ORIGINS = [<span class="hljs-string">'http://*'</span>, <span class="hljs-string">'https://*'</span>]
</code></pre>
<blockquote>
<p>if Your running an project in localhost then you should open all urls here <code>*</code> symbol means all urls also there is <code>http://</code> is mandatory.</p>
</blockquote>
<hr />
<h2 id="heading-second-solution">Second Solution</h2>
<blockquote>
<p>This is Also for Localhost and for <code>DEBUG=True</code>.</p>
<blockquote>
<p>Copy the list of ALLOWED_ORIGINS into CSRF_TRUSTED_ORIGINS like given below.</p>
</blockquote>
</blockquote>
<pre><code class="lang-python">ALLOWED_ORIGINS = [<span class="hljs-string">'http://*'</span>, <span class="hljs-string">'https://*'</span>]
CSRF_TRUSTED_ORIGINS = ALLOWED_ORIGINS.copy()
</code></pre>
<hr />
<h2 id="heading-third-solution">Third Solution</h2>
<p>When Deploying you have to add urls to allow form uploading ( making any POST request ).</p>
<p>I Know this maybe tricky and time consuming but it's now mandatory.</p>
<p>Also this is Mandatory to Online IDEs also like Replit, Glitch and Many More.</p>
<p>Give an reaction if any solutions helped you for algorithm boost to my content.</p>
<p>bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[PHP - Introduction by shriekdj | How to write Hello World Program in PHP by shriekdj]]></title><description><![CDATA[PHP Tutorials by shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/php-introduction-by-shriekdj-or-how-to-write-hello-world-program-in-php-by-shriekdj</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/php-introduction-by-shriekdj-or-how-to-write-hello-world-program-in-php-by-shriekdj</guid><category><![CDATA[PHP]]></category><category><![CDATA[PHPUnit]]></category><category><![CDATA[Hello World]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Thu, 07 Apr 2022 05:54:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1649310758233/lyLvGlMFD.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-preface">Preface</h2>
<p>For Becoming Back-end Web Developer in PHP You Should At least Know How to Create <code>HTML</code> Files and also know what are the <code>HTML</code> files are.</p>
<p>Also PHP Should Be Already Installed on your PC, Device, Server, Sandbox or Virtual Machine ( Whatever You are using Maybe Toaster Also 😅 Don't Know What will Be Machine ).</p>
<blockquote>
<p>The Given Post is about PHP 8 and Above.</p>
</blockquote>
<p>PHP Code is created under an HTML Template. Actually PHP is Used like additional element of HTML.</p>
<p>In Short PHP Code Embeded Under HTML Code.</p>
<blockquote>
<p>Creating Hello World Program In PHP.</p>
<blockquote>
<p>There are many ways of Running PHP At Many Places As of Now.</p>
</blockquote>
</blockquote>
<hr />
<h2 id="heading-hello-world-program-in-php-for-cli">Hello World Program In PHP For CLI</h2>
<p>First Create an Text File <code>index.php</code> with any text edito and Type the Text Given Below.</p>
<pre><code class="lang-php"><span class="hljs-meta">&lt;?php</span>
  <span class="hljs-keyword">echo</span> <span class="hljs-string">"Hello, World!"</span>;
</code></pre>
<p>PHP Code Start With <code>&lt;?php</code> and Ends With <code>?&gt;</code> .</p>
<blockquote>
<p>But At here we don't need and shouldn't add the Closing Tag of PHP, Because It is an <strong>Pure PHP</strong> without embedding PHP into <strong>HTML</strong> Tags otherwise it may give you an Error.</p>
</blockquote>
<p>For Running PHP Code In Terminal</p>
<pre><code class="lang-bash">user123@ubuntu:~/ php index.php
Hello, World!
</code></pre>
<p>As you can see it prints Hello World On Command Line, Shell or Terminal</p>
<hr />
<h2 id="heading-hello-world-program-in-php-for-cli-with-parsing-php-code-under-html">Hello World Program In PHP For CLI with parsing php code under HTML</h2>
<p>Just Change Your <code>index.php</code> file's content to Given Below</p>
<pre><code class="lang-php">&lt;html&gt;
&lt;body&gt;
  <span class="hljs-meta">&lt;?php</span> <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;p&gt; Hello, World! &lt;/p&gt;"</span>; <span class="hljs-meta">?&gt;</span>
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>Output Will Be Given Below On Terminal Not Browser</p>
<pre><code class="lang-html">user123@ubuntu:~/ php index.php
<span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span> Hello, World! <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>Here you can see there is an <code>?&gt;</code> for closing the PHP Code, Because it is not an Pure PHP file and it Contains Mixture of HTML and PHP.</p>
<blockquote>
<p>But PHP part is Parsed as per the HTML File it Needed.</p>
<blockquote>
<p>Closing Tag of PHP is <strong>required</strong> in Non Pure PHP File.</p>
</blockquote>
</blockquote>
<hr />
<h2 id="heading-hello-world-program-in-php-with-built-in-web-server">Hello World Program in PHP With Built-in Web Server.</h2>
<p>For running under the built-in server we just have add some flags to our php commands.</p>
<ul>
<li><code>-S &lt;addr&gt;:&lt;port&gt;</code> : Run with built-in web server. (  It's Capital S not Small s. ).</li>
<li><code>-t &lt;docroot&gt;</code> :  Specify document root <code>&lt;docroot&gt;</code> directory for built-in web server. For Current directory use <code>.</code> as <code>&lt;docroot&gt;</code></li>
</ul>
<p>Run the Given Code With Following Commands.</p>
<pre><code class="lang-php">php index.php -S <span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">8000</span> -t .
</code></pre>
<p>Output wil be given below if we open <code>http://127.0.0.1:8000</code> or <code>http://localhost:8000</code> in our web browser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1649309883202/VUZ-avLpE.png" alt="Hello World Program Running on localhost:8000 under PHP" /></p>
<blockquote>
<p>In PHP You don't need to Specify the file name if it is <code>index.php</code>, because if you don't specify the filename it will by default check for the <code>index.php</code> file in the directory.</p>
</blockquote>
<hr />
<blockquote>
<p>This built in server is for only running php code, so if you want to run something like mysql, apache with it then you will need LAMP or XAMP server on PC or Web server</p>
</blockquote>
<p>In Short this built-in server should be used for development environments only.</p>
<p>After a long I Wrote the Blogpost this Long Size, But I Just Wanted to share the details.</p>
<p>Also Give you thoughts about this post in the comments and give reactions for Algorithm boost 😉.</p>
<p>Thanks and Bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[PHP - Installation on Linux Based Operating System]]></title><description><![CDATA[PHP Tutorials by shriekdj Series]]></description><link>https://shriekdj.hashnode.dev/php-installation-on-linux-based-operating-system</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/php-installation-on-linux-based-operating-system</guid><category><![CDATA[PHP]]></category><category><![CDATA[Ubuntu]]></category><category><![CDATA[Linux]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Tue, 05 Apr 2022 12:28:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1649161309457/R4ZUAE2RN.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So I Will Try to Make Series About the PHP.</p>
<p>PHP is an Scripting language Majorly Used for Back-end Web Development and also more than 50 % websites on internet use PHP as back-end.</p>
<h2 id="heading-development-environment-on-linux">Development Environment on Linux</h2>
<p>One of the most common server configuration for linux is LAMP stack (Linux, Apache, MYSQL, PHP).</p>
<p>For Linux we will try to install apache, MySQL separately and try not to install third party applications.</p>
<p>You can still install XAMPP if you prefer, but remember in production you should not try third party applications.</p>
<hr />
<h2 id="heading-check-system-updates-of-linux">Check System updates of Linux</h2>
<pre><code class="lang-bash">sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist -upgrade
</code></pre>
<ul>
<li>Here <code>sudo</code> is for superuser ( as a linux user you may already know it ).</li>
<li>Here all packages and whole operating system is being updated and upgraded.</li>
</ul>
<hr />
<h2 id="heading-installing-apache-server-on-linux">Installing Apache Server On Linux</h2>
<pre><code class="lang-bash">sudo apt-get install Apache2
</code></pre>
<ul>
<li>We Use apache server for running our site under localhost</li>
</ul>
<hr />
<h2 id="heading-installing-mysql-on-linux-based-operating-system">Installing MySQL on Linux Based Operating System</h2>
<pre><code class="lang-bash">sudo apt-get install mysql-server

sudo my_sql_secure_installation.
</code></pre>
<ul>
<li>It will ask to create database password so Create an Secure Password.</li>
</ul>
<hr />
<h2 id="heading-start-an-apache-server-on-linux">Start an Apache Server On Linux</h2>
<pre><code class="lang-bash">sudo service apache2 start
</code></pre>
<p>You will get the below image on screen.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1649159980091/S_16JUpLn.png" alt="apache2-ubuntu-default-page.png" /></p>
<hr />
<h2 id="heading-start-mysql-through-another-terminal-simultaneously">Start MySQL through another terminal simultaneously</h2>
<pre><code class="lang-bash">sudo mysql -u root
</code></pre>
<p>Image Given Below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1649160281357/2zOOfOFBe.jpg" alt="MySQL Starting Commands In Ubuntu Terminal" /></p>
<hr />
<h2 id="heading-now-actually-installing-php-on-linux-lol">Now Actually Installing PHP on Linux Lol 😂</h2>
<pre><code class="lang-bash">sudo apt-get install PHP
</code></pre>
<p>This command will install PHP with it's default settings, so you will need to locate the PHP.ini file which can be located at <code>/etc/PHP/8.1/apache2</code> and also in <code>etc/PHP/8.1/cli</code>.</p>
<hr />
<h2 id="heading-installing-and-configuring-phpmyadmin-in-ubuntu-linux">Installing and Configuring phpmyadmin in Ubuntu / Linux</h2>
<p>if you want PhpMyAdmin for setting up and making or altering your database in much more flexible way, you can use following commands.</p>
<pre><code class="lang-bash">sudo apt-get install PHPmyadmin
</code></pre>
<p>You Will also need to Configure apache to include phpmyadmin with following command.</p>
<pre><code class="lang-bash">sudo <span class="hljs-built_in">echo</span> -e <span class="hljs-string">"\include etc/PHPmyadmin/apache.conf"</span> &gt;&gt;/etc/apache2/apache2.conf
</code></pre>
<p>This is how you are ready to execute and run PHP programs on Linux.</p>
<p>Thanks for reading give your thoughts in the comments.</p>
<p>Bye 👋.</p>
]]></content:encoded></item><item><title><![CDATA[I Created an Template for Django project for Running Under Services like replit, heroku etc]]></title><description><![CDATA[There are many Online Services Out There and We Want to Test or Run Our Django Project On There, But There are Some Issues Occurred For Running On Them…]]></description><link>https://shriekdj.hashnode.dev/i-created-an-template-for-django-project-for-running-under-services-like-replit-heroku-etc</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/i-created-an-template-for-django-project-for-running-under-services-like-replit-heroku-etc</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Django]]></category><category><![CDATA[Python]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[template]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Sun, 03 Apr 2022 04:41:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1648961866917/3oeetXnl9.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-preface">Preface</h2>
<p>There are many Online Services Out There and We Want to Test or Run Our Django Project On There, But There are Some Issues Occurred For Running On Them.</p>
<h2 id="heading-details">Details</h2>
<h3 id="heading-for-replit-online-ide">For Replit Online IDE</h3>
<p>Like for Replit it is by default supported with Poetry Virtual Environment and Project Runs on 0.0.0.0 instead of localhost and Changes in Django Project Settings.</p>
<h3 id="heading-for-heroku-platform-as-a-service">For Heroku : Platform as a Service</h3>
<p>For Heroku It Needs an Procfile which is like runner file for heroku.</p>
<p>This Is an GitHub Repo Which Can You Use it as Starter for Running Under Replit, Heroku and More(In Future).</p>
<h2 id="heading-this-repos-is-able-run-under-services-like">This Repos is Able run Under Services Like</h2>
<ul>
<li>Replit : An Online IDE</li>
<li>Heroku : Platform As A Service</li>
</ul>
<h2 id="heading-github-repo-shriekdjdjangoprojecttemplate">GitHub Repo : shriekdj/django_project_template</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/shriekdj/django_project_template">https://github.com/shriekdj/django_project_template</a></div>
]]></content:encoded></item><item><title><![CDATA[Replit Was Unable to Build the Virtual Environment for Python Project]]></title><description><![CDATA[Replit Was Unable to Build the Virtual Environment for Python Project or the Project Not Giving Results As We Expected.]]></description><link>https://shriekdj.hashnode.dev/replit-was-unable-to-build-the-virtual-environment-for-python-project</link><guid isPermaLink="true">https://shriekdj.hashnode.dev/replit-was-unable-to-build-the-virtual-environment-for-python-project</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[IDEs]]></category><category><![CDATA[problem solving skills]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Shrikant Dhayje]]></dc:creator><pubDate>Tue, 29 Mar 2022 19:50:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1648583362214/y76pbJALt.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-problem">Problem</h2>
<blockquote>
<p>Replit Was Unable to Build the Virtual Environment for Python Project or the Project Not Giving Results As We Expected.</p>
<blockquote>
<p>This Issue Can also happened to Other Online IDEs Also Like Glitch.</p>
</blockquote>
</blockquote>
<h2 id="heading-details">Details</h2>
<blockquote>
<p>Most Online IDE Already Use Virtual Environment By default already. even if you create an virtual environment with <code>python -m venv venv</code> it will not gonna run again in next run like next day and all packages install with <code>pip install --</code> needs to install again.</p>
<blockquote>
<p>The venv by <code>python -m venv venv</code> for replit is not efficient.</p>
</blockquote>
</blockquote>
<h2 id="heading-first-solution">First Solution</h2>
<blockquote>
<p>Replit uses Poetry Virtual Environment By Default for Python Project. Those are given below.</p>
<blockquote>
<p>Note These should run under the <strong>shell</strong> tab not the console tab.</p>
</blockquote>
</blockquote>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Command With Pip</td><td>Command With Poetry</td></tr>
</thead>
<tbody>
<tr>
<td><code>python main.py</code></td><td><code>poetry run python main.py</code></td></tr>
<tr>
<td><code>pip install package_name</code></td><td><code>poetry add package_name</code></td></tr>
<tr>
<td><code>python -m venv venv</code></td><td><code>poetry init</code></td></tr>
<tr>
<td><code>source venv/bin/activate</code></td><td><code>poetry shell</code></td></tr>
<tr>
<td><code>python manage.py runserver</code></td><td><code>poetry run python manage.py runserver</code></td></tr>
</tbody>
</table>
</div><blockquote>
<p>Mostly just add <code>poetry run</code> at first of running script like add this script to runner file of replit.</p>
<blockquote>
<p>Click 3 dots in Open Editor of replit and click Show Hidden File and Edit the File Named <code>.replit</code> to given below.</p>
</blockquote>
</blockquote>
<pre><code class="lang-python">language = <span class="hljs-string">"python3"</span>
run = <span class="hljs-string">"poetry run python manage.py runserver 0.0.0.0:8000"</span>
<span class="hljs-comment"># this is for django</span>
</code></pre>
<h2 id="heading-second-solution">Second Solution</h2>
<blockquote>
<p>Try Installing the alternative virtual environment named <code>pipenv</code> for the installing packages via <code>requirements.txt</code> file.</p>
<blockquote>
<p>For Local Environment we add this package like <code>pip install pipenv</code> but for replit online IDE we go into shell tab and then add package by poetry.</p>
</blockquote>
</blockquote>
<pre><code class="lang-python">poetry add pipenv

<span class="hljs-comment"># then run below comman to install dependencies from requirements.txt file</span>
pipenv -r requirements.txt
</code></pre>
<blockquote>
<p>For <strong>pipenv</strong> Most Commands are already similar you just need to replace the word <code>pip</code> with <code>pipenv</code>.
For Activating Pipenv Virtual Environment type <code>pipenv shell</code></p>
<blockquote>
<p><code>.replit</code> should have something like below run command.</p>
</blockquote>
</blockquote>
<pre><code class="lang-python">language = <span class="hljs-string">"python3"</span>
run = <span class="hljs-string">"pipenv install &amp;&amp; pipenv run manage.py runserver 0.0.0.0:8000"</span>
<span class="hljs-comment"># just like given below but upper will work perfectly.</span>
<span class="hljs-comment"># run = "pipenv run manage.py runserver 0.0.0.0:8000"</span>
</code></pre>
<blockquote>
<p>This Commands for mostly running outside virtual environment without activating it directly.</p>
</blockquote>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Command With Pip</td><td>Command With Pipenv</td></tr>
</thead>
<tbody>
<tr>
<td><code>python main.py</code></td><td><code>pipenv run python main.py</code></td></tr>
<tr>
<td><code>pip install package_name</code></td><td><code>pipenv install package_name</code></td></tr>
<tr>
<td><code>python -m venv venv</code></td><td><code>pipenv init</code></td></tr>
<tr>
<td><code>source venv/bin/activate &amp;&amp; pip install -r requirements.txt</code></td><td><code>pipenv shell &amp;&amp; pipenv shell</code> or just <code>pipenv install</code></td></tr>
<tr>
<td><code>python manage.py runserver</code></td><td><code>pipenv run python manage.py runserver</code></td></tr>
</tbody>
</table>
</div><h2 id="heading-conclusion">Conclusion</h2>
<blockquote>
<p>I Will Suggest You Use Poetry Because It Have Some Features for replit.</p>
</blockquote>
<ul>
<li>Faster Installing and file runing process ( compared to pipenv ).</li>
<li>Packages are not deleted after opening the repl again on next day.</li>
<li>CPU Load was lower Compared to <code>pipenv</code>.<ul>
<li>I Ran An Package to install dependencies and the package had more than 50 dependencies for debugging <code>home-assistant/core</code> at github.</li>
<li>CPU Gone at Overheating but did not cross the line of cpu Usags ( For Me ).</li>
</ul>
</li>
</ul>
<p><a target="_blank" href="https://replit.com/">Replit</a> is an online IDE, hosting cloud, collaborative programming environment, and so much more. I've been a user for a while and I really want to voice out what I love about them.</p>
<p>Give a reaction if any one solutions helped you in any way.
Bye 👋.</p>
]]></content:encoded></item></channel></rss>