Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Python server(Django web site)/client(Python app) connection
#1
Here is my situation:
I’ve got Django web site(url shortener) with its database. This database consists all data about url.
I'm going to make a simple Python program, that would work like my site: you give long url and it make short one, and it should write these 2 urls to my site's database.
I dont know anything about socket programming so I'm asking your help, guys.
Should I make a Python server in Django site and a client in Python app?
And what should I do if I want many people to use this app at the same time
Quote
#2
Hi,

well, there are a couple of question in your post, but they are not really questions.

Quote: I dont know anything about socket programming so I'm asking your help, guys.
+
What leads you to the assumption that you need socket programming? To cut it short: you don't need it.

Quote: And what should I do if I want many people to use this app at the same time
Ask money from the people and get rich :D Seriously: what's the problem with that? As long as your server can handle the number of request, no worries. In case it can't -> upgrade the server. In case you ever reach the point where a single server can handle that anymore -> post again here.

What I don't get yet from you post: you say you have the URL shortner already as a Django app - than you should have the client application in the form of a web page already? So what do you mean exactly be "client in Python app"?

Regards, noisefloor
Quote
#3
(Jul-05-2019, 10:02 AM)Junior_Pythoneer Wrote: Should I make a Python server in Django site and a client in Python app?
And what should I do if I want many people to use this app at the same time
How it works is that for all local development you use the build web-server that comes wit Django.
When finish and only if want to share with the world,then need a host.

A good tutorial from a good host DigitalOcean.
How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 18.04

More recommendations here.
Running Django in the App Engine flexible environment
Quote
#4
Guys, i read your answers and i understood that there's no need to use socket programming.
Here's what my app should do:
1. User write some data(long url)
2. These data go to Django server
3. Django server, using these data, make another data(short url) and saves it in database
4. Django server sends new data(short url) back to User
I read something about REST API, is it what i need, or not?
Quote
#5
(Jul-05-2019, 03:00 PM)Junior_Pythoneer Wrote: 1. User write some data(long url)
2. These data go to Django server
3. Django server, using these data, make another data(short url) and saves it in database
4. Django server sends new data(short url) back to User
I read something about REST API, is it what i need, or not?
All of this is still local development,so here you use the build in web-server that comes with Django.
Using REST is a internal choice you make,can use it or not.

So the point here is that you have all that's needed to make the web-app finish with Database.
Only when all is finish and think of sharing it with world,the need a host as posted over.
Then change out the build web-server,to something that is production ready eg Gunicorn with Nginx in front.
noisefloor likes this post
Quote
#6
Hi,

 I read something about REST API, is it what i need, or not? 
Depends on how you want to do it. If the URL is entered on a HTML page delivered by Django -> not REST necessary.

If Django should receive a GET request with the URL only and should respond with the shortened URL -> you need a REST-type interface.

So basically you need to make up your mind how you want to do it.

If you go for REST: the are Python webframeworks like Hug which focus on REST APIs only. On what you described so far, I see no advantage in using Django specifically for your task.

Regards, noisefloor
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Make sockest keep connection LavaCreeperKing 3 272 May-21-2019, 05:05 AM
Last Post: heiner55
  How to combine data taken from server between client and GUI? bescf 9 596 Apr-02-2019, 11:48 AM
Last Post: bescf
  Graphql subscriptions client Edoar 0 245 Mar-11-2019, 04:13 PM
Last Post: Edoar
  Multi connection socket server help! MuntyScruntfundle 0 333 Feb-19-2019, 12:03 PM
Last Post: MuntyScruntfundle
  TCP/IP client script help Rehan11 2 550 Jan-15-2019, 06:48 AM
Last Post: Rehan11
  recive post request from client(browser) python sockets kunz 1 595 Dec-13-2018, 12:53 AM
Last Post: kunz
  No connection could be made becouse the target machine actively refused it. GottaAimHigherPal 1 585 Oct-18-2018, 01:59 PM
Last Post: Larz60+
  Need Help in ssh connection hareesh 3 770 Oct-04-2018, 07:59 AM
Last Post: hareesh
  tcp server/client port connection issue valshev 2 1,359 Sep-01-2018, 02:50 PM
Last Post: valshev
  Frames above 2000 bytes not acknowledged by client/receiver lukasz139 0 550 Aug-24-2018, 06:34 PM
Last Post: lukasz139

Forum Jump:


Users browsing this thread: 1 Guest(s)