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
  simple udp server/client cardmaker 2 144 Nov-26-2019, 12:36 AM
Last Post: micseydel
  Slow websockets server -> client pattagghiu 0 191 Sep-17-2019, 09:28 AM
Last Post: pattagghiu
  Chat (Client-Server) andresdrr 3 352 Aug-26-2019, 02:01 PM
Last Post: ThomasL
  How to combine data taken from server between client and GUI? bescf 9 875 Apr-02-2019, 11:48 AM
Last Post: bescf
  Multi connection socket server help! MuntyScruntfundle 0 445 Feb-19-2019, 12:03 PM
Last Post: MuntyScruntfundle
  recive post request from client(browser) python sockets kunz 1 712 Dec-13-2018, 12:53 AM
Last Post: kunz
  tcp server/client port connection issue valshev 2 2,154 Sep-01-2018, 02:50 PM
Last Post: valshev
  Send data BMP180 between client and server trought module socket smalhao 0 766 Jul-30-2018, 12:56 PM
Last Post: smalhao
  Sending/Receiving Multiple Message from Server or Client Lyperion 0 1,403 Jul-30-2018, 07:52 AM
Last Post: Lyperion
  Converting web server from python 2 to python 3 floatingshed 5 2,275 Jul-14-2018, 03:28 PM
Last Post: floatingshed

Forum Jump:


Users browsing this thread: 1 Guest(s)