Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Instructions to connect MySQL #16

Open
jatinkatyal13 opened this issue Oct 27, 2018 · 9 comments
Open

Instructions to connect MySQL #16

jatinkatyal13 opened this issue Oct 27, 2018 · 9 comments
Labels
code-in enhancement New feature or request

Comments

@jatinkatyal13
Copy link
Collaborator

We need to provide instructions in our README to connect our application to MySQL backend using the environment variables.

@jatinkatyal13 jatinkatyal13 added enhancement New feature or request code-in labels Oct 27, 2018
@isaac-philip
Copy link
Contributor

isaac-philip commented Oct 27, 2018

Please provide more information.
Could not find any mysql reference, only sqlite in settings.py

@jatinkatyal13
Copy link
Collaborator Author

In the below code snippet if we are in the development environment we by default use sqlite but we should take this as an input from the environment and hence such changes are needed to be made!

if DEBUG:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        }
    }
else:
    DATABASES = dj_database_url.config(default=config('DATABASE_URL'))

Library that can be really helpful will be DJ Database Url

@isaac-philip
Copy link
Contributor

So when you say environment,
you wish to parse an Environment Variable DATABASE_URL which would contain the database connection string and the information from that utilizing the dj_database_url library.

Think that makes sense to me, just confirming with you on that above

@jatinkatyal13
Copy link
Collaborator Author

Precisely 🚀

@isaac-philip
Copy link
Contributor

Hello, tried to setup environment locally by following steps in README.md
Failing at
makemigrations

with error that the specific configs are not placed like SECRET_KEY

Please let me know some dummy configs etc and any more information how to setup environment.
Any docker container for the same etc?
Just saying it could really speed up development taking care of various dependencies.

I believe I would need an sqllite db for the application to start and a mysql db for this specific issue.

Thanks for your patience.

@jatinkatyal13
Copy link
Collaborator Author

@isaac-philip Checkout the example .env.sample file! Setting up the environment section of README explains that!
Hope this helps

@isaac-philip
Copy link
Contributor

Thanks I did had a look but couldn't complete, will try in couple of days!

isaac-philip added a commit to isaac-philip/certificate-generator-server that referenced this issue Nov 25, 2018
1. Implemented the value to be parsed into the databases settings.

2. This value is parsed from the operating system environment variable
  `DATABASE_URL`

3. Added information highlighting the usage in Readme.md

Resolves JBossOutreachArchive#16
isaac-philip added a commit to isaac-philip/certificate-generator-server that referenced this issue Nov 26, 2018
1. Implemented the value to be parsed into the databases settings.

2. This value is parsed from the operating system environment variable
  `DATABASE_URL`

3. Added information highlighting the usage in Readme.md

Resolves JBossOutreachArchive#16
isaac-philip added a commit to isaac-philip/certificate-generator-server that referenced this issue Dec 1, 2018
1. Implemented the value to be parsed into the databases settings.

2. This value is parsed from the operating system environment variable
  `DATABASE_URL`

3. Added information highlighting the usage in Readme.md

4. Placed necessary Environment Variable `DATABASE_URL` in .travis.yml for CI

Resolves JBossOutreachArchive#16
@isaac-philip
Copy link
Contributor

Hello, any updates or modifications needed ?

@isaac-philip
Copy link
Contributor

hello, just asking if not yet merged any modifications needed? Please advise for any direction needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
code-in enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants