Skip to content
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

Create a separate settings.py file for per-user settings #83

Open
ashish-b10 opened this issue Jan 19, 2019 · 1 comment
Open

Create a separate settings.py file for per-user settings #83

ashish-b10 opened this issue Jan 19, 2019 · 1 comment
Assignees

Comments

@ashish-b10
Copy link
Owner

ectc_tm_server/settings.py has some information that is either sensitive or will have to change on a per-user setup. We want settings.py to have some good defaults, but also to be able to accommodate both developers and users. This issue should:

  1. Create a script that generates the following:

    • SECRET_KEY (initialized to some randomized value)
    • DEBUG (initialized to True)
    • DATABASES (not sure what to initialized this to, but we can ask users to edit it)
    • ALLOWED_HOSTS (initialized to an empty list, users can edit this too)
  2. Edit settings.py to import this information from the output file. The code would look something like this:

# add the path that settings.py is in to the libary import path
current_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, current_dir)
from custom_settings import SECRET_KEY, DEBUG, ...
# remove this path from library import path
sys.path.pop(0)
@ashish-b10 ashish-b10 self-assigned this Jan 19, 2019
@ashish-b10
Copy link
Owner Author

Note that you can generate a secret key like so:

from django.core.management.utils import get_random_secret_key
get_random_secret_key()
'fn$%h(h%t-g5@q*sl173)silolx^==^e(ysc9@&(n7s3=ypfiz'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants