-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve SQLite default settings #9
Conversation
I'm open to the idea, but I would need this added to the 4.1 template as well and then the code that auto updates the templates would need to be updated to add that change, or maybe a better approach would be to modify the code that creates the new project to make those changes to the new project files. |
The In any case, I'll move the change from the template to a python function called by |
Yeah, I don't think we need bother with adding it for older versions of Django. So you could add some logic to add if the version is greater than 5.1. |
These settings make SQLite scale better in production environments with higher concurrency.
bd4f87d
to
bfcc317
Compare
@@ -47,6 +67,7 @@ | |||
'SECRET_KEY="{{ secret_key }}"', | |||
"ALLOWED_HOSTS=", | |||
"DATABASE_URL=sqlite:///{{ project_dir }}/db.sqlite3", | |||
"{% 5.1 %}" + SQLITE_OPTIONS_ENV, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% 5.1 %}
feels like a hack, so please let me know if you have a better idea for running asserts based on the Django version.
@epicserve I've added the logic for both the env and non-env versions. Let me know if this works for you! |
I made a couple commits and merged. I switched to using a tuple instead of prefixing with the I also switched to using a constant for the options, so you only have to change it in one place. Also when the options are in a URL, I made sure the options where URL encoded. |
Hey! I really like your idea of simplifying the creation of new projects and I was wandering if you'd also like to add a better out of the box experience for SQLite.
The changes in the PR should make SQLite scale better in high concurrency environments (some benchmarks) and remove the most common SQLite gotchas.
I also want to propose the same change to Django's startproject template, but I figured it would be a good idea to try this out on your project first. Let me know what you think!