Project structure for a serverless project [closed] - python

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm writing a Python project that will be a serverless with 3 handlers:
Get partner contacts;
Get partner deals;
Get partner flows;
Each handler will be based on date range and for each line retrieved on partner calls, it will save into database.
The macro flow would be something like:
-> partner
begin execution -> handler -> service -> end execution
-> databse
Based on that, I have created the following structure:
|my-project
serverless.yaml
|src
|handlers (similar to controllers)
|services
|infrastructure
|database
|partner
|test
|handlers (similar to controllers)
|services
|infrastructure
|database
|partner
Does it make sense? And about the partner functions? It's a single partner, should I create a single partner class with those functions or should I create a single python class for each function?
I see a problem creating a single file because every call needs to create a client - it's something like client = Partner(user, token).
I want to make this project looks great but I don't want to write every single stuff that we have on OOP.

Related

Mass user registration with Python, FastAPI and PostgreSQL [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 days ago.
Improve this question
Goodnight.
I'm developing a project that is a Web System for managing a company in which it will register customers and leads through an excel file, files that will contain 20k, 30k and even 60k. And I'm using FastAPI for the Back End.
I would like ideas on the best way to do this registration:
Use a Webhook: The API receives the file, copies the 60k data and sends it in JSON to a Webhook that will register in PostgreSQL.
Using the API: The API performs all registrations asynchronously, the user sends it through an asynchronous request using JavaScript to the API and it takes care of the rest, which can break the API?
Which option do you think is better? Share ideas with me.
At the moment I'm waiting for ideas to execute.

Should I create Apps for each Model in my django app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 10 months ago.
Improve this question
I have just learned python, and am beginning to make a web application using Django / DRF in the back end.
The back end would be similar to a CRUD, or just a CRUD actually, I'm not planning on doing too much processing on requests, but would be queuing jobs for another python script on the server to pick up when needed.
The API I'm building would need to manage a few different entities like Users, Packages, Transactions, Jobs etc, and I plan to manage all of these entities... no ... models... via a rest API.
Do I create an app for each model ? e.g. user_app, package_app, and transaction_app ? or should I create a single app to manage them all?
I'm torn between thinking of Django Apps as actual applications, or Bundles like in PHP/Symfony
There is no obligation to create a new app for every feature that depends on another part of the project logic.
But overall the more you divide into, the easier it will be in the future.
when the project updated and new features added it will be easy to manage it.
Also take a look at some open source projects.

I am creating a social networking site using django, should I have create a email app [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am creating a social networking site using django. I will send lots of emails depending on the user actions. Should I create an email app or just create an email_funcitons.py file in each individual app. Which is best practice?
Apps created so far:
Accounts
NewsFeed
Profile
Notifications
Messaging
Privacy
You should create separate module. There is no reason to have same function implemented in multiple places, it makes your code hard to maintenance.
Each functionality should have own module (in this case app), so modifying email you will have to modify only one file/module, not all email functions in all modules

Build a simple django A/B Testing framework [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am not a expert django developer. I am building a site to gather user information and also run experiments. I want to build an A/B testing module to simply do following:
Randomly assign users to control and test group
Depend on the group that user is in allow user to have access to features.
I saw some heavyweight A/B testing modules they seems very complicated for my application and I realize adding something like that without understanding many nuts and bolts in django would cause me more trouble.
My question is how should I start building this? Can someone point me towards similar sample code where I can begin with and then built on top of that.
The simplest (but definitely not the best) way would be to do something like this:
def some_view(request):
test_pool = request.user.id % 2 # all users will be in test_pool 0 or 1
if test_pool == 0:
# allow feature
else:
# don't allow feature

Python - How to run a specific function with variables [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm new to Python. This is the code I am trying to use, basically I am trying to start by adding a hosted zone:
http://ijabour.com/myfaceapp/build/boto/bin/route53
The function for this is: create
If I want to add a hosted zone called "test.com", how would I use this library to do this? I want to know how to involve a specific function in this python file and parse an argument to it.
When you want to call the create function in that module, just import the module and call the create function.
import route53
conn = .... # init connection here
route53.create(conn, "test.com")

Categories