How to choose between development or production environment in a Doctype class
See original GitHub issueHi,
I have this Doctype class to work with persistence in my project.
#developtment is a boolean variable.
from config import cluster,cluster_test, development
from elasticsearch import Elasticsearch
from elasticsearch.helpers import scan
if development:
# We change to cluster from development
es = Elasticsearch(cluster_test)
connections.create_connection(hosts = cluster_test)
else:
es = Elasticsearch(cluster)
connections.create_connection(hosts = cluster)
class MyExampleClass(DocType):
MyString = String(index='not_analyzed')
AnotherParameter = String(index='not_analyzed')
timestamp = Date()
updated_at = Date()
There is another way to declare this class to connect this class to production or development environment without modify the development variable in the configuration file and passing development as a paremeter to this class.
Thanks in advance.
Best regards
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Difference Between Development, Stage, And Production
The production environment is where users access the final code after all of the updates and testing. Of all the environments, this one...
Read more >Understanding environments - Janel Brandon - Medium
Each developer on a team has their own development environment, and each developer is responsible for making sure that their development ...
Read more >Using Multiple Environments to Improve Your Development ...
Production : Once the code has been thoroughly tested, it is then pushed to production where it is made available to end-users. The...
Read more >Environments | Codecademy
In this article, you'll learn about the different environments that a project can be in as it goes through the process of development...
Read more >Optimized Development Environment: Pydantic Tutorial, Part 2
Learn how to develop a Django application coupled with pydantic where the development environment matches production.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok, thanks for your help !!
Happy to help. Note that you really shouldn’t need access to the
Elasticsearch
instance for the most common operations - all the dsl methods supportusing
kwarg which you can just pass the alias (dev
in this case) as a string.