Two Days with Python & GraphQL


An web application needed to be built. An external API will give me a list of information packets as JSON. The JSON has the information and the user object. The application’s job is to store this data in a local database and provide an user interface to sort and filter this data. Simple enough.

GraphQL kept coming up on on the internet. A number of tools were saying they support GraphQL in their home pages and was making me curious. The requirement also said:

use the technology of your choice REST/GraphQL to build the backend

Now, I had to see what’s it all about. So I sat down read the docs and got a basic understanding of it. It made total sense theoretically. It solved a major problem I face when building Single Page Applications and the Backed REST APIs independently. The opaqueness of incoming data and the right method to get them.

Common Scenario I run into

While building the frontend, we assume use the schema that the backend people give as the source of truth and build it based on that. But the schema becomes stale after a while and changes need to be made. There are many reasons to it:

  • adding/removal/renaming of an attribute
  • optimisations that come into play, which alter the structure
  • the backend API is a third party one and searching and sorting are involved
  • API version changes
  • access control which restricts the information contained..etc.,

And even when we have a stable API, there is the issue of information leak. When you working with user roles, it becomes very confusing very quickly because a request to /user/ returns different objects based on the role of the requester. Admin sees different set of information than a privileged user and a privileged user sees a different set of data than an unprivileged one.

And more often than not, there is a lot of unwanted information that get dumped by APIs on to the frontend than what is required, which sometimes even lead to security issues. If you want to see API response overload take a look under the hood of Twitter web app for example, the API responses have a lot more information than what we see on screen.


Enter GraphQL

GraphQL basically said to me, let’s streamline this process a little bit. First we will stop maintaining resource specific URLs, we are going to just send all our requests to /graphql and that’s it. We won’t be at the mercy of the backend developers whim’s and fancies about how to construct the URL. No more confusing between /course/course_id/lesson/lesson_id/assignments and /assignments?course=course_id&lesson=lesson_id. Next, no, we are not going to use HTTP verbs, everything is just a POST request. And finally no more information overload, you get only what you ask. If you want 3 attributes, then you ask 3, if you want 5 then you ask 5. Let us eliminate the ambiguity and describe what you want as a Graphql document and post it. I mean, I have been sick of seeing SomeObject.someAttribute is undefined errors. So I was willing to put in the effort to define my requests clearly even it meant a little book keeping. Now I will know the exact attributes that I am going to work with. I could filter, sort, paginate all just by defining a query.

It was a breath of fresh air for me. After some hands on experiments I was hooked. This simple app with two types of objects were the perfect candidate to get some experience on the subject.

Day/Iteration 1 – Getting the basic pipeline working

The first iteration went pretty smooth. I found a library called Graphene – Python that implemented GraphQL for Python with support for SQLAlchemy, I added it to Flask with Flask-GraphQL and in almost no time I had a API up and running that will get me the objects, and it came with sorting and pagination. It was wonderful. I was a little confused initially, because, Graphene implements the Relay spec. So my queries looked a little over defined with edges and nodes than plain ones. I just worked with it. I read a quick intro about Connections and realised I didn’t need to worry about it, as I was going to be just querying one object. Whatever implications it had, it was for complex relations.

For the frontend, I added Vue-Apollo the app and I wrote my basic query and the application was displaying data on the web page in no time. It has replaced both Vuex state management and Axios HTTP library in one swoop.

And to help with query designing, there was a helpful auto completing UI called GraphIQL, which was wonderful.

Day/Iteration 2 – Getting search working

Graphene came with sorting and filtering inbuilt. But the filtering is only available if you use Django as it uses django-filter underneath. For SQLAlchemy and Flask, it only offers some tips. Thankfully there was a library called Graphene-SQLAlchemy-Filter which solved this exact problem. I added that and voila, we have a searchable API.

When trying to implement searching in frontend is where things started going sideways. I have to query all the data when loading the page. So the query looked something like

query queryName {
  objectINeeded {
    edges {
      nodes {

And in order to search for something, I needed to do:

query queryName {
  objectINeeded(filters: { attribute_1: "filter_value" }) {

And to sort it would change to:

query queryName {
  objectINeeded(sort: ATTRIBUTE_1_ASC, filters: { attribute_1: "filter_value" }) {

That’s okay for predefined values of sorting and filtering, what if I wanted to do it based on the user input.

1. Sorting

If you notice closely, the sort is not exactly a string I could get from user as an input and frankly it is not even one that I could generate. It is Enum. So I will have to define an ENUM with all the supportable sorts and use that. How do I do that? I will have to define them in a separate GraphQL schema document. I tried doing that and configured webpack to build them and failed miserably. For one, I couldn’t get it to compile the .graphql files. The webloader kept throwing the errors and I lost interest after a while.

2. Searching

The filters is a complex JSON like object that could support OR, AND conditions and everything. I want the values to be based on user input. Apollo supports variables for that purpose. You can do something like this in the Vue script

apollo: {
  myObject: {
    gql: `query GetDataQuery($value1: String, $value2: Int) {
      objectINeed( filters: [{attr1: $value}, {attr2: $value2}] {
    variables() {
      return { value1: this.userInputValue1, value2: this.userInputValue2 }

This is fine when I want to employ both the inputs for searching, what if I want to do only one? Well it turns out I have to define a different query altogether. There is no way to do an optional filter. See the docs on Reactive Queries.
Now that was a lot of Yak shaving I am not willing to do.

Even if I did the Yak Shaving, I ran into trouble on the backend with nested querying. For example what if I wanted to get the objects based on the associated user? Like my query is more like:

query getObjects {
  myObject {
    user(filters: {first_name: "adam"}) {

The Graphene SQLAlchemy documentation said I could do it, it even gave example documentation, but I couldn’t get it working. And when I wanted to implement it myself, the abstraction was too deep that I would have to spend too many hours just doing that.

3. The documentation

The most frustrating part through figuring out all this was the documentation. For some reason GraphQL docs think that if I used Apollo in the frontend, then I must be using Apollo Server in the backend. Turns out there is no strict definition on the semantics for searching/filtering, only on the definition of how to do it. So what the design on the backend should match the design on the frontend. (Now where have I heard that before?) And that’s the reason documentation usually shows both the client and server side implementations.

4. Managing state

An SPA has a state management library like Vuex, Redux to manage application state, but with GraphQL, local state is managed with a GraphQL cache. It improves efficiency by reducing the calls to the server. But here is the catch, you have to define the schema of the objects for that to work. That’s right, define the schema as in write the models in GraphQL documents. It is no big deal if your stack is fully NodeJS, you can just do it once and reference it in both places.

In my case, I will have defined my SQLAlchemy models in Python in the backend, and I will have to do it again in GQL for the frontend. So changes have to be synced between them if anything changes. And remember that each query is defined separately, so I will have to update any query that will be affected by the changes.

At this point I was crying. I has spent close to 8 hours figuring out all this.

I gave up and rewrote the entire freaking app using REST API and finished the project including the UI in the next 6-7 hours and went to bed at 4 in the morning.


  1. GraphQL is a complex solution for a complex problem. You can solve simple problems with it but the complexity will hit you at some point.
  2. It provides a level of clarity in querying data that REST API doesn’t, but it comes with a cost. It is cheap for cheap work and costly for larger requirements. Almost like how AWS bills raise.
  3. No it doesn’t provide the kind of independence between the backend and frontend as it seems like on the surface. This might by lack of understanding and not the goal of GraphQL at all, but if you like me made this assumption, then just know it is invalid.
  4. Use low-level libraries to implement GraphQL, and try to keep it NodeJS. At least for the sake of sharing the schema documents if not for anything. If I has implemented the actions myself instead of depending on Graphene and adding a filter library on top of that, I would have fared better.

Moving back from Mac to Windows + Linux

Content Warning: Rant ahead

As my Macbook Air is becoming more and more restrictive to the things I could do, due to low memory of 4 GB and 128GB SSD, I decided to buy a new laptop with better specifications. After some filtering and comparison on Flipkart and Amazon, I finally settled on Lenovo S540 14″ with 8 GB RAM and 1TB SSD. It also came fitted with a 2GB Graphics card which I think will help working with ML algorithms easier. While the hardware is great for my requirement, the software is a complete let down.

Issue 1: Windows Font Rendering is Crap

The screen is a full HD 1920×1080 display in 14 inches. One would think the display would try to match that of the display of my Macbook Air (1440×900), but nope. Not in a million chance.

The system recommends a scaling of 150% for good results, anything below that the system font Calibri starts breaking down and there seems to be no anti-aliasing effect.

There are a couple of solutions to this problem, like setting the scaling to 100% and increasing the font size separately. This works to a certain degree, but doesn’t achieve the smoothness of 150% scale.

Now I have an interface that seems to be adjusted for my Grandma’s failing eye sight.

Issue 2: Microsoft loves Linux – My Feet

I think the whole MS loves Linux non-sense started almost the same time I bought a Macbook. So I never experienced what it meant. I now get what it meant, they wanted to sell Linux machines on their Azure cloud and that’s about it. Whatever contributions they must have done, should have centered around that goal. Because installing Linux in a Windows 10 machine is more difficult now than it was 5-8 years ago. Back then, it was just a matter of knowing how to partition disks and ability to choose the boot disk. Now I had to:

  • Create the bootable disk in a specific format for UEFI compatibility
  • Run a command to change the Storage access method from RST to ACHPI
  • Go into BIOS and disable Secure Boot, and change the ACHPI
  • Boot into Safe Mode so that the disk can work with changed storage
  • Finally boot into install disk and install.

What should have taken me 15-30 minutes took me 2 and a half hours.

Issue 3: Windows 10 is a Data Collection Pipeline

I am really horrified at the number of buttons that I had to turn off during the setup process and I still find as I use the system.

Issue 4: Application Management in Windows

Windows Store is a disaster, I don’t know what is installed in my system and what isn’t. There are tiles for games that aren’t installed and there is no way to differentiate between a tile of an installed application and a tile of a shortcut for an application that is recommended for install.

Issue 5: Why are tiles in Start Menu?

With 150% scale, it always feels like I am seeing only a part of the actual screen when the tiles come up. I don’t understand how MSFT understood that they should go back to the start menu but decided they will keep the tiles nonetheless. Either tile or don’t, consistency please, the mashup is nuisance and everybody should just learn to live with it.

Issue 6: Application Management in Ubuntu

So everybody has been bit by the centralised application distribution model. But tell me which serious software actually gets published? At least none of the ones I seem to use, even in the Mac OS ecosystem which started the stores concept. MS Office, Adobe Creative Suite, IDEs like PyCharm, Android Studio, Eclipse, Browsers… everything is package download from vendor sites. But that hasn’t stopped Canonical from creating Snap store. Now I seriously don’t know why there is a software centre and also a Snap Store and there is good old apt package manager.

The Good Bits in Linux

It’s been 24 hours of hell with the new system. Yet, not everything is bad.

  • Once up and running, I haven’t encountered Wifi or Bluetooth driver issues.
  • The Kernel seem to be pretty stable.
  • Grub has themes and OS selection is stylish.
  • Memory usage is pretty low
  • Font rendering and antialiasing is spot on. I think I just need some time to get used to 16:10 to 16:9 aspect ratio
  • The drivers for the Graphics card are in place
  • Tap to click and Natural Scrolling keep my UX is same across both my machines


After a frustrating 24 hours of the setting up the system. I have completely given up on Windows. As ususal Linux will be my primary OS. Will turn to Windows for recording tutorial videos or when collaboration required MS Office, or maybe games. If money wasn’t an issue, I don’t think I would have moved from Mac to PC at all. Things like 3 finger application switching, desktop switching are still etched in me. So, personally I prefer

  1. MacOS
  2. Ubuntu
  3. Windows… I would try my best not to boot this thing.


The Mastodon ecosystem is really nice. The concept of Fediverse bringing in decentralized social network is a breath of fresh air. I created NiftyBot account in – a dedicated server for Mastodon Bots.

What is NiftyBot?

  • It is a Mastodon Bot Account

What does it do?

  • It posts updates about Indian Markets
  • Currently it posts NSE closing report at 4.01 PM everyday. Sample post below


How does it work?

It is a Python script running in AWS Lambda.


A scheduler tiggers the Lambda Function at 4.01 every Monday – Friday. The lambda function is a Python Script that fetches the necessary details from NSE’s output data and posts to Mastodon.

Source Code:

Some asked about if this bot is open source. Obviously, you see the source right here. 🙂 Still I will add the license here.

The above source code is released into the Public Domain. You can do what ever you want with it.

How much does it cost to run this Bot?


Numbers Please:

The AWS Lambda Free tier comes with 1 Million requests and 400,000 GBSec, which is a combination of how much memory we use and the time taken by our process. Since I have used the CloudWatch Scheduler Event as the trigger, I am using 20-22 requests, the Python function takes about 60 MB to run so running at the lowest memory of 128MB block, and usually completes in around 2600-2700 msec. The metrics says my worst billed event so far is about 0.3375 GBSec. With about 20-22 trading days in a month, I might use a total of 8-10 GBSeconds, leaving enough room to run many more bots like this one 🙂

Investment Strategy: SIP vs SMA 50

Update: Big one. Scroll to the bottom to see it.

I tend to believe investment is a long term activity. It is something I will be engaged in till my end. So the money is going to be invested for about 40 – 50 years. With that long an outlook, a low cost Index fund in Equity is as good as anything. I set out to see if there is a better strategy to be executed than doing a monthly cost averaging or Systematic Investment Plan (SIP).


The idea behind a SIP is simple, every month on a given date you buy the same thing for a given amount. But one thing bugs me, the most optimal time to buy in that month is not always the date the SIP purchase happens. So I set out to see if I can use the Simple Moving Average (SMA 50) technical indicator to find the BUY signals for investing.

SMA based Strategy

The strategy is

Whenever the PRICE closes below the 50 DAY SMA, we buy. If it doesn’t cross for X number of months, then the money just accumulates and sits idle.

The strategy tries to optimize the buying price to stay below the average price – a pseudo fair price.

So here is what I did, I used Streak to create a strategy and generated all the signals for the SBI Nifty 50 ETF


I set the stoploss at 15% and a profit booking at 5%. The higher stoploss and lower profit limit are to maximize the number of BUY signals. As the idea is NOT to trade, but to invest. I am only interested in the BUY signals, ideally I won’t sell it for 20-30 years.

A good trading strategy?

Interestingly, it seems like a pretty good positional trading strategy with Zero loss trades and generating 16+% CAGR. Impressive. Maybe some trader can tell me it this is worth it after all the taxes and brokerage 🙂

Total Units

Anyway, getting back to my analysis – I downloaded the strategy with dates and prices at which the trades happened. From them, I calculated the number of units I could have bought, if I put aside 1000 rupees every month and bought only on the BUY signals from January 01, 2016 to October 31, 2019 (46 months)


It comes to around 410 Units


Now I wanted to know how many units could I have bought if I did a regular SIP for the same period with the same amount of money for the same time period. Using Moneycontrol SIP calculator, I got


I would have bought 468 Units. Yup, an extra 58 units over the SMA 50 Strategy.


The probable cause for the underperformance of the SMA 50 strategy is that, the money sits ideally for 7 or 8 months at certain times when the index is trending up and and SMA hasn’t caught up to it. This loss of time results in the poor performance of this strategy. Time is literally money. So time lost is money lost.


After some tweets from @IndiaEtfs, I came with an SMA 50 augmented SIP strategy, which tries to catch the SMA crossing down every month, if it doesn’t occur, just invest it on 1st of the following month. This way, we are not letting the money sit idle and are using the opportunity of paying lower prices when it happens.

The result wasn’t that surprising. The returns were almost the same as that of the SIP.


The difference is merely 1 unit which I assume is nothing when you round off when buying whole units on the market. So unless someone devises a method to find out the market bottom, we investors are better off just doing SIPs consistently.

Pop-Out a box effect in DaVinci Resolve 16

1508177128_1366318 I have been working on some video editing using DaVinci Resolve 16 for the Tutorial videos I have been posting on YouTube. One of the most used effect in tutorial videos is the pop-out effect (I don’t really know the exact name) where a portion of the screen is cut and enlarged while the rest of the screen is darkened to bring the focus to that particular area of the frame.


This is really useful to bring the attention of the user to a particular area on the screen. I have searched the internet and haven’t found the right tutorial to do it. Finally after much trial and error I figure out a Fusion graph that will get it done.



  1. Go to the start of the clip
  2. Add a rectangle node (or any shape for that matter)
  3. Create a keyframe. Adjust the rectangle to the area to popout
  4. Add a transform node between the MediaIn and MediaOut
  5. Add a keyframe with default values on the first frame
  6. Connect the rectangle as the mask for the Transform Node
  7. Add a Color Gain node after the transform and add a keyframe, set Lock the RGB values and set the gain to 0.5
  8. Connect the rectangle to the Color Gain and Use the Apply Inverted Mask option on the mask tab in inspector
  9. Move to the end of the effect (something like frame 30)
  10. Adjust the transform size and position
  11. Match the size and position of the rectangle
  12. Play, test and adjust for any artifacts.

PyCharmஇல் Flask செயலி உருவாக்குவது எப்படி?

PyCharm என்பது ஒரு ஒருங்கினைந்த நிரலாக்க மென்பொருள். ஆங்கிலத்தில் Integrated Development Environment (IDE) என செல்லும் ஒரு நிரலாக்கக் கருவி. நாம் செய்யும் வேலையின் தரம் நாம் பயன்படுத்தும் கருவிகளைக்கொண்டே இருக்கிறது. ஒரு சிற்பிக்கு அது நன்றாகத் தெரியும். மென்பொருள் உருவாக்கம் சிலை செதுக்குவதைக் காட்டிலும் கடினமான விடயமா என்று தெரியாது, உறுதியாகச் சிக்கலான ஒன்று என்றே நான் கூறுவேன். எனவே நாம் பயன்படுத்தும் கருவிகளும் அதற்கு நிகரானதாக இருக்கு வேண்டும். Notepad, Notedpad++, Emacs, Eclipse, VIM, Atom, VS Code என பலவற்றில் நிரல் எழுதி இப்பொழுது கடைசி 3 ஆண்டுகளாக வருடம் 7-8ஆயிரம் செலவழித்து Professional Edition வாங்கிப் பயன்படுத்தும் அளவிற்கு உடன் நிற்பது PyCharmதான்.

இனி Python Flask தொடரில் வரும் கட்டுரைகள் எல்லாம் நான் அதிலேயெ எழுதப்போகிறேன். நீங்களும் பயன்படுத்துமாறு கேட்டுக்கொள்கிறேன். (உங்க Mind voice கேக்குது. இல்லை. எனக்கு இதில் எந்த ஆதாயமும் இல்லை)

Flask தொடரில் இதற்கு முன் வந்த கட்டுரைகள்:
1. Python Flask என்றால் என்ன?
2. Python Flaskஐ நிறுவுவது எப்படி?
3. Flaskஇல் நம் முதல் செயலி

என்னாது? 7-8 ஆயிரம் செலவழிக்கனுமா?


PyCharm இல் இரண்டு பதிப்புகள் உள்ளன. ஒன்று காசு கொடுத்து வாங்க வேண்டிய Professional Edition, மற்றொன்று இலவசமாகக் கிடைக்கும் Community Edition. இந்த தொடரில் நான் பயன்படுத்தப்போவது எல்லாமே Community Edition தான். இன்னும் ஏன் யோசனை?

PyCharm இல்லாமல் இந்தத் தொடரை மேலும் படிக்க முடியாதா?

கண்டிப்பாக முடியும். உங்களுக்கு PyCharm வேண்டாம் என்றால், தாராலமாக உங்களுக்கு பிடித்த கருவிகளைப் பயன்படுத்தாலாம். நாம் Flask கற்றுக்கொள்ள PyCharm அவசியம் கிடையாது. ஆங்காங்கே நான் இடும் படங்கள் PyCharm இன் படங்களாக இருக்க வாய்ப்பு உள்ளது, அதற்கு நிகரான விசயங்களை உங்களுடைய கருவியிலும் பார்த்துக்கொள்ளவும்.

Flask Project உருவாக்கம்

PyCharmஐ திறந்து கொள்ளவும்.


அதில் Create New Project-ஐச் சொடுக்கவும்.


வரும் பெட்டியில் நாம் கொடுக்க வேண்டியது இரண்டு விசயங்கள்:

  1. நம் Project-ஐ எங்கு சேமிக்கப்போகிறோம். உங்களுக்கு பிடித்தமான இடத்தை அங்கு கடைசியில் இருக்கு “Browse” பொத்தானை அமுக்கி தேர்வு செய்து கொள்ளவும். புதிதாக ஒரு folder உருவாக்க வேண்டும் எனில் அதை கடைசியில் டைப் செய்து விடுங்கள். எ.கா. என் கணினியில் நான் code எனும் folderஇல் எல்லா projectகளையும் சேர்த்து வைத்து உள்ளேன். அதனால் code எனும் போல்டரை தேர்வு செய்துவிட்டு, /flaskapp என்பதை தட்டச்சு செய்துவிட்டேன்.
  2. நாம் எந்த Python version ஐப் பயன்படுத்தப்போகிறோம். உங்கள் கணினியில் ஒரே ஒரு Python மட்டும் இருக்கலாம், அல்லாது பலவையும் இருக்கலாம். எனது கணினியைப் பாருங்கள்


இதில் நாம் எதை நம் செயலி உருவாக்கத்திற்கு பயம்படுத்தப் போகிறோமோ அதைத் தேர்வு செய்ய வேண்டும். நாம் Python 3யைத்தான் இக்கட்டுரைத் தொடரில் பயன்படுத்தவிருக்கிறோம். எனவே Python 3ஐ தேர்வு செய்து கொள்ளுங்கள்.

தேர்வு செய்தவுடன் Create பொத்தானை சொடுக்கவும். இப்பொழுது PyCharm நமக்கான project folderஐ உருவாக்கி அதனுள் ஒரு virutal environmentஐ நமக்கு உருவாக்கித் தந்துவிடும். அது முடிந்தவுடன், PyCharmஇன் project/editor window திறந்து விடும்.


இதில் நாம் தெரிந்துகொள்ள வேண்டிய இடங்கள் 5.

  1. இங்குதான் நாம் நம் தரவுகளை எழுதுவோம்
  2. இது நம் projectஇல் உள்ள கோப்புகளை பார்வையிட மற்றும் மாற்றங்கள் செய்ய உதவும் Project Tree
  3. நம் project folderக்குள் எதேனும் கட்டளைகள் இட விரும்பினால் அதற்கு தேவையான Terminal. இதின் சிறப்பு என்னவென்றால், நாம் source env/bin/activate என்று நமது environmentஐ நாம் activate செய்யத்தேவையில்லை. அது தானாகவே activate ஆகிவிடும். நாம் நேராக நமது வேலையை செய்யலாம்.
  4. Python Console – இது உங்களுக்கு எதாவது சிறு சிறு Python வரிகளை சோதித்துப்பாக்க பயன்படும்.
  5. Configuration Manager – இங்கு நாம் நமது செயலியை இயக்கிப் பார்க்கத் தேவையானவற்றை பதிவு செய்து, இயக்கி, பிழைகளை கண்டறியும் இடம்.

Flask செயலி எழுதுதல்

கீழே உள்ள terminalஐத் திறந்து, Flaskஐ நிறுவும் கட்டளையை இடவும்

pip install flask


அது முடிந்ததும், project treeஇல் உங்கள் project folderஇன் மேல் வலது-“க்ளிக்” செய்து ஒரு புது Python கோப்பை உருவாக்கவும். அதற்கு என்று பெயரிடுங்கள்.


இப்பொழுது திறந்து இருக்கும் அந்த கோப்பில் நம் முதல் செயலிக்கான தரவைப் தட்டச்சு செய்து கொள்ளுங்கள்.

from flask import Flask

app = Flask(__name__)

def home():
    return "Hello World!"

நீங்கள் தட்டச்சு செய்யும் பொழுதே PyCharm உங்களுக்கு உதவ ஆரம்பிப்பதைக் காணலாம்.


முழு தரவையும் தட்டச்சு செய்தவுடன் “Save” செய்து கோப்பை பத்திரப்படுத்திவிடவும்.


செயலியை இயக்கி சோதிப்பது

வலதுபுறம் மேலே உள்ள “Add Configuration” பொத்தானை சொடுக்கவும். உடனே அது ஒரு New Configuration பெட்டியத் திறக்கும்.


இதில் உள்ள + குறியை சொடுக்கி ஒரு Python configurationஐ உருவாக்கவும்.


அங்கு நிங்கள் செய்ய வேண்டியவை 4


  1. Script Pathஇல் உள்ள folder பொத்தானை சொடுக்கி உங்கள் projectக்குள் இருக்கும் virtual environment (venv)க்குள் bin -> flask என்பதைத் தேர்வு செய்து கொள்ளவும்.
  2. Parametersஇல் run எனத் தட்டச்சு செய்யவும்.
  3. Environment Variablesஇல் FLASK_APP=app;FLASK_ENV=development; என்பதைச் சேர்க்கவும்.
  4. Nameஇல் “Dev Server” என்று கொடுக்கவும்

அதை OK கொடுத்து மூடி விடவும். இப்பொழுது Dev Sever என்று ஒரு Configuration உங்களுக்கு உருவாகி இருக்கும். அதன் அருகில் உள்ள run பொத்தானை அமுக்கினால், நம்முடைய Flask server வேலை செய்ய ஆரம்பிப்பதைக் காணலாம்.



இதில் Flaskஇன் server ஆரம்பமாகி, நம்முடைய செயலியை நாம் பார்க்க செல்ல வேண்டிய முகவரி இருக்கும். அந்த முகவரியை சொடுக்கினால், சென்ற கட்டுரையைப் போலவே நமக்கு Hello World எனும் செய்தி காத்திருக்கும்.


ஒரு terminalஐயும் text editorஐயும் வைத்து செய்த வேலையை இப்படி என்ன என்னமோ configuration எல்லாம் செய்து பயன்படுத்த வேண்டுமா என்று நினைத்தால், கவலைப்படாதீர்கள். இந்த ஒரு முறை இதை செய்து விட்டோம் என்றால் அடுத்த முறை நாம் எதுவும் செய்ய வேண்டியது இல்லை.


திறந்தவுடன் நமக்கு நம்முடைய project காட்டும். சோதித்துப்பார்க்க நாம் நேரடியாக Dev sever ஐ ஆரம்பிக்காலாம். வேலை முடிந்ததும் மூடி விடலாம். Text Editor, terminal, virtual environment activate செய்வது, Flask app பதிவிட்டு பிறகு run செய்வது என பல விசயங்களில் கவனம் சிதறவிடத் தேவையில்லை.

உங்களுக்கு இதில் எதேனும் ஐயங்கள் இருந்தால் கீழ பதிவிடவும். நன்றி.

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.