<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tej Magar</title>
    <description>The latest articles on DEV Community by Tej Magar (@tejmagar).</description>
    <link>https://dev.to/tejmagar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F788164%2F1077a1e9-7cc4-441e-953d-36d83b570f2a.jpeg</url>
      <title>DEV Community: Tej Magar</title>
      <link>https://dev.to/tejmagar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tejmagar"/>
    <language>en</language>
    <item>
      <title>ASO guide to your app rank on Google Play Store</title>
      <dc:creator>Tej Magar</dc:creator>
      <pubDate>Fri, 08 Jul 2022 01:52:12 +0000</pubDate>
      <link>https://dev.to/tejmagar/aso-guide-to-your-app-rank-on-google-play-store-1of4</link>
      <guid>https://dev.to/tejmagar/aso-guide-to-your-app-rank-on-google-play-store-1of4</guid>
      <description>&lt;p&gt;You have made an awesome app, but it's not ranking on Google Play Store? Don't worry I will share awesome 7 tips to rank your apps on Google Play Store. Even if your app is new, and your competitor has 5 Million above downloads, you can still rank your app on top of the Google Play Store.&lt;/p&gt;

&lt;p&gt;The keyword is a very important factor for ranking your app on Google Play Store. You can think of a keyword as a search term that general people will use to find apps on the Play Store. If another app is featured on a certain keyword that you want your app to rank for, you can replace a competitor's app if you make proper use of keywords.&lt;/p&gt;

&lt;p&gt;Your app will rank in different positions in different countries over time. The ranking of this app might be different in the United States and the Philippines.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. App icon
&lt;/h2&gt;

&lt;p&gt;Your app icon and the colors used should be different than of your competitors. This will make people catch their attention faster on your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use keywords in your app title
&lt;/h2&gt;

&lt;p&gt;Find the search term that you think people might search for finding similar apps to yours. You can use keywords in your app title after your app name. For example, &lt;a href="https://play.google.com/store/apps/details?id=tej.wifithiefdetector&amp;amp;hl=en&amp;amp;gl=US"&gt;WiFi Thief Detector - Who uses my WiFi&lt;/a&gt;. Doing this doesn't change your original app name.&lt;/p&gt;

&lt;p&gt;I used this technique at the beginning to improve my rank app on Google Play Store faster. People searching for the keyword "WiFi Thief Detector" and "Who uses my WiFi", both can see the app on Google Play Store.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Use keywords in your app short description
&lt;/h2&gt;

&lt;p&gt;Similarly, think of a search term that people will search by the feature. Then, make a short description using those keywords. You shouldn't flood the descriptions with keywords only, your sentence should look natural.&lt;/p&gt;

&lt;p&gt;For full article, check out: &lt;a href="https://sagasab.com/blog/7-aso-tips-to-rank-your-apps-on-google-play-store/"&gt;https://sagasab.com/blog/7-aso-tips-to-rank-your-apps-on-google-play-store/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Django WebSocket tutorial for begineers</title>
      <dc:creator>Tej Magar</dc:creator>
      <pubDate>Sat, 02 Jul 2022 13:41:12 +0000</pubDate>
      <link>https://dev.to/tejmagar/django-websocket-tutorial-for-begineers-gd9</link>
      <guid>https://dev.to/tejmagar/django-websocket-tutorial-for-begineers-gd9</guid>
      <description>&lt;p&gt;In this tutorial, we will make a simple real-time random number generator site using Django WebSocket as shown below. To make things simpler we are not going to use Redis server or channel layers. I will paste the link of the example code at the end of the article. So, let's set up our project😉&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J7hfPUwk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/44mxig0l1tn2qfdr8qm8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J7hfPUwk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/44mxig0l1tn2qfdr8qm8.gif" alt="Image description" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install the following requirements&lt;br&gt;
Django&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install django&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Channels&lt;br&gt;
&lt;code&gt;pip install channels&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After installing all the requirements, update the &lt;code&gt;settings.py&lt;/code&gt; file of your project. Add channels in the list of Installed Apps. See below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'channels'
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to add ASGI_APPLICATION in the settings.py. We will add it below of the WSGI_APPLICATION.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;WSGI_APPLICATION = 'channelsdemo.wsgi.application'&lt;br&gt;
ASGI_APPLICATION = 'channelsdemo.asgi.application'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now let's create a file named consumers.py and create a class named NumberGenerator which extends WebSocketConsumer class. We will make a loop that generates a random number using random.randint(1, 1000) and json.dumps() converts the dictionary to a text. The text will be sent to the client using &lt;code&gt;self.send()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json
import random
from time import sleep

from channels.generic.websocket import WebsocketConsumer


class NumberGenerator(WebsocketConsumer):

    def connect(self):
        self.accept()

        while True:
            data = {
                'number': random.randint(1, 1000)
            }

            self.send(json.dumps(data))

            sleep(1)

    def disconnect(self, code):
        print("Socket disconnected with code", code)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;URL Patterns for the asgi app&lt;br&gt;
We will create new URL patterns for the web sockets. It is same as Django urlpatterns. So, create a file named &lt;code&gt;ws_urlpatterns.py&lt;/code&gt; with the following patterns.&lt;br&gt;
&lt;/p&gt;

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

from channelsdemo.consumers import NumberGenerator

ws_urlpatterns = [
    path('ws/', NumberGenerator.as_asgi(), name='number-generator')
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Modifying asgi.py file&lt;br&gt;
This file is automatically created when channels was installed. We will use the ws_urlpatterns.py which was created earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os

from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application

from channelsdemo.ws_urlpatterns import ws_urlpatterns

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'channelsdemo.settings')

application = ProtocolTypeRouter({
    'http': get_asgi_application(),
    'websocket': URLRouter(ws_urlpatterns)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's create index.html inside the template directory. Before that, we need to add a template directory to settings.py.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Index.html&lt;br&gt;
We will monitor the data coming from the WebSocket and display it in the browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;title&amp;gt;Websocket example&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;style&amp;gt;

    body {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background-color: #333;
    }

    #number {
        font-size: 1.6rem;
        color: white;
    }

&amp;lt;/style&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;p id="number"&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;script&amp;gt;
    const socket = new WebSocket("ws://localhost:8000/ws/");

    socket.onmessage = function (event) {
        const data = JSON.parse(event.data);
        console.log(data);
        document.querySelector('#number').innerHTML = data.number;
    }
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our site is almost completed. We just need to add some views to the Django project. Create a &lt;code&gt;views.py&lt;/code&gt; file and add the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.shortcuts import render


def home(request):
    return render(request, 'index.html')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can see the random number every second changing in the browser. If you like this content, check out more articles here.&lt;/p&gt;

&lt;p&gt;Github Url: &lt;a href="https://github.com/tejmagar/django-channels-websocket-example"&gt;https://github.com/tejmagar/django-channels-websocket-example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>websocket</category>
      <category>programming</category>
      <category>python</category>
    </item>
  </channel>
</rss>
