<?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: Tolgahan ÜZÜN</title>
    <description>The latest articles on DEV Community by Tolgahan ÜZÜN (@tolgahanuzun).</description>
    <link>https://dev.to/tolgahanuzun</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%2F129308%2Fe887bea4-802f-4375-ae76-31c01773a277.jpeg</url>
      <title>DEV Community: Tolgahan ÜZÜN</title>
      <link>https://dev.to/tolgahanuzun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tolgahanuzun"/>
    <language>en</language>
    <item>
      <title>Create Your Own S3 Service For Your Django Project</title>
      <dc:creator>Tolgahan ÜZÜN</dc:creator>
      <pubDate>Tue, 10 Mar 2020 11:38:37 +0000</pubDate>
      <link>https://dev.to/tolgahanuzun/create-your-own-s3-service-for-your-django-project-36o8</link>
      <guid>https://dev.to/tolgahanuzun/create-your-own-s3-service-for-your-django-project-36o8</guid>
      <description>&lt;p&gt;There are many projects with which you can install replica of Amazon S3 service in local environment. I am using the project named S3 Ninja from these. Let me tell you how to make an S3 replica with simple steps. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://s3ninja.net/"&gt;S3 Ninja&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation and Run Serve.
&lt;/h1&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker pull scireum/s3-ninja:4
docker run -p 9444:80 scireum/s3-ninja:4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I assume you have no problems and the installation is complete!&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a Bucket
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eLBzVM31--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.hizliresim.com/CprZu9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eLBzVM31--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.hizliresim.com/CprZu9.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was so easy!&lt;/p&gt;

&lt;h2&gt;
  
  
  Codes to add settings for Django
&lt;/h2&gt;

&lt;p&gt;You must install this package and add it to the app list. &lt;a href="https://pypi.org/project/django-storages/"&gt;django-storages&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_ACCESS_KEY_ID = ‘access_key_id’
AWS_SECRET_ACCESS_KEY = ‘secret_access_key’
AWS_STORAGE_BUCKET_NAME = 'Bucket'
AWS_S3_ENDPOINT_URL = 'http://localhost:9444/s3/'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  And action
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ea6_KkEv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.hizliresim.com/PzfT4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ea6_KkEv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.hizliresim.com/PzfT4q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upload an image in the project. You need to do this using &lt;code&gt;from django.core.files.storage import default_storage&lt;/code&gt;. Now your installation process will serve your own S3 service.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R-mq0Hj8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.hizliresim.com/uaI7FQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R-mq0Hj8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.hizliresim.com/uaI7FQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>s3</category>
      <category>aws</category>
      <category>django</category>
      <category>python</category>
    </item>
    <item>
      <title>Django Test Plus Extensions</title>
      <dc:creator>Tolgahan ÜZÜN</dc:creator>
      <pubDate>Wed, 18 Dec 2019 11:51:58 +0000</pubDate>
      <link>https://dev.to/tolgahanuzun/django-test-plus-extensions-jh9</link>
      <guid>https://dev.to/tolgahanuzun/django-test-plus-extensions-jh9</guid>
      <description>&lt;p&gt;&lt;a href="https://pypi.org/project/test_plus/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2f4KkVHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/pypi/v/test-plus.svg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/tolgahanuzun/test_plus"&gt;https://github.com/tolgahanuzun/test_plus&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Django Test Plus Extension is an advanced tool for Django tests. Motivation; This is a detailed analysis of the atomic parts of Django tests. In short, each running test understands how long it runs.&lt;/p&gt;

&lt;p&gt;The total time information of Django tests is returned. There are more than a thousand test cases in the company I work for. I wanted to analyze long tests and correct mistakes.I saw such a shortcoming, I aimed to write a package.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support and Update
&lt;/h2&gt;

&lt;p&gt;Inspired by the Django Extensions package. It is free and open to improvement. I can improve if you tell me your needs. You can also support the development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install test_plus
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and&lt;/p&gt;

&lt;p&gt;Add it to INSTALLED_APPS in your projects settings.py file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSTALLED_APPS = (
    ...
    'test_plus',
    ...
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Using and Result
&lt;/h2&gt;

&lt;p&gt;It takes the same parameter in Django tests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py test_plus
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py test_plus app_name.test.test_file -k -v 2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--21fF6lZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/tolgahanuzun/test_plus/master/test.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--21fF6lZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/tolgahanuzun/test_plus/master/test.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>test</category>
    </item>
    <item>
      <title>Simple tricks for map solution</title>
      <dc:creator>Tolgahan ÜZÜN</dc:creator>
      <pubDate>Thu, 15 Aug 2019 08:36:42 +0000</pubDate>
      <link>https://dev.to/tolgahanuzun/simple-tricks-for-map-solution-2n92</link>
      <guid>https://dev.to/tolgahanuzun/simple-tricks-for-map-solution-2n92</guid>
      <description>&lt;p&gt;In the past, we used the map google map service for the map solution. As the project grew, google map began to write high amounts of cost. We looked for a few solutions here and, divided our needs into 2 parts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Dynamic display of latitude and longitude data. (embed)&lt;/li&gt;
&lt;li&gt;Find latitude and longitude data using street, shop and home address. (geocoding)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Embed solution
&lt;/h2&gt;

&lt;p&gt;Here are a few alternatives. (openstreetmap, google map, mapbox vs...) I will evaluate the difference between google map and mapbox.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Legacy solution: &lt;a href="https://developers.google.com/maps/billing/gmp-billing#dynamic-maps"&gt;&lt;strong&gt;Google Map: SKU: Dynamic Maps&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more than 100,000 requests:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- 5.60 USD per 1000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example: 500.000 (100k free) requests: &lt;strong&gt;2.240 USD&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New solution: &lt;a href="https://www.mapbox.com/pricing/#maploads"&gt;&lt;strong&gt;Map Loads for Web&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more than 50,000 requests:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- (50,001 to 100,000) 5.00 USD per 1000
- (100,001 to 200,000) 4.00 USD per 1000
- (20,001 to 1000,000) 3.00 USD per 1000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example: 500.000 (50k free) requests: &lt;strong&gt;1.560 USD&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Profit&lt;/strong&gt; : 680 USD&lt;/p&gt;

&lt;h3&gt;
  
  
  Development process
&lt;/h3&gt;

&lt;p&gt;I was using the react-leaflet library in the front. (openstreetmap) The Leaflet library is very convenient and convenient. You can define api as Custom.&lt;/p&gt;

&lt;p&gt;Highly recommend the &lt;code&gt;react-leaflet&lt;/code&gt;. :)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;LeafletMap&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;TileLayer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-leaflet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;LeafletMap&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;TileLayer&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`https://api.mapbox.com/styles/v1/{#username}/{#project}/tiles/{z}/{x}/{y}?access_token={#token}`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/LeafletMap&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Geocoding solution
&lt;/h2&gt;

&lt;p&gt;There is no alternative to this substance at this time. The alternatives are quite inefficient. It negatively impacts user experience. I recommend using Google Map.&lt;/p&gt;

</description>
      <category>map</category>
      <category>optimization</category>
      <category>google</category>
      <category>mapbox</category>
    </item>
    <item>
      <title>Standard and Streaming Response Comparison with Aiohttp Library</title>
      <dc:creator>Tolgahan ÜZÜN</dc:creator>
      <pubDate>Thu, 04 Jul 2019 08:23:38 +0000</pubDate>
      <link>https://dev.to/tolgahanuzun/standard-and-streaming-response-comparison-with-aiohttp-library-3f3c</link>
      <guid>https://dev.to/tolgahanuzun/standard-and-streaming-response-comparison-with-aiohttp-library-3f3c</guid>
      <description>&lt;p&gt;Github Repository: &lt;a href="https://github.com/tolgahanuzun/Streaming_API" rel="noopener noreferrer"&gt;Streaming_API&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the project I developed, we return a great response message to the API calls of the customers. It takes a long time to process large data. At this stage, the memory swells and the server CPU increases. To prevent this, we started using streaming method.&lt;/p&gt;

&lt;p&gt;I've done an analysis to explain what this process has brought us. I have compared a normal response to a call request and streamed a call request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working area
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python3.6&lt;/li&gt;
&lt;li&gt;Aiohttp&lt;/li&gt;
&lt;li&gt;PostgreSql (SQLAlchemy)&lt;/li&gt;
&lt;li&gt;500000 rows of data set&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Referenced from the github readme file.)&lt;/p&gt;

&lt;h2&gt;
  
  
  How to install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github.com:tolgahanuzun/Streaming_API.git
virtualenv &lt;span class="nt"&gt;-p&lt;/span&gt; python3 venv
&lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate
&lt;span class="nb"&gt;cd &lt;/span&gt;Streaming_API
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirement.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;vim settings.py&lt;/code&gt; and you need to edit the settings file yourself.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to run
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Serve
&lt;/h4&gt;



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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Client
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;JWT needs it. You can remove it if you want.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Accept: text/plain'&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: JWT eyJ0eX....."&lt;/span&gt;  &lt;span class="nt"&gt;-v&lt;/span&gt; http://0.0.0.0:8080/standard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Accept: text/plain'&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: JWT eyJ0eX....."&lt;/span&gt;  &lt;span class="nt"&gt;-v&lt;/span&gt; http://0.0.0.0:8080/chunked
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Process analysis
&lt;/h1&gt;

&lt;p&gt;Chunked data comes to you piece by piece.&lt;br&gt;
In the standard, the data comes at once.&lt;br&gt;
Incoming data sample.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Standard Response
&lt;/h2&gt;

&lt;p&gt;All data is captured, processed and sent at one time. Blocks each other. In this example, it corresponds to 500000 row.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Up to 0.16 seconds no data flow occurs. The data comes after that second.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;h2&gt;
  
  
  Streaming Response
&lt;/h2&gt;

&lt;p&gt;The dataset size is 500000 rows. Data from the database is taken as 1000 row. Each group of data is processed and streamed without waiting.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Up to 0.04 seconds no data flow occurs. The data comes after that second.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Look out! The Streaming API finished before the Standard API started sending data. It didn't block itself because it sent and received data in pieces.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

</description>
      <category>python</category>
      <category>stream</category>
      <category>streaming</category>
      <category>aiohttp</category>
    </item>
  </channel>
</rss>
