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

Fresh Non-Docker Install unable to login #109

Open
MrCarter2959 opened this issue Dec 9, 2019 · 5 comments
Open

Fresh Non-Docker Install unable to login #109

MrCarter2959 opened this issue Dec 9, 2019 · 5 comments

Comments

@MrCarter2959
Copy link

Seems like the non-docker install guide found here https://github.com/open-eats/OpenEats/blob/master/docs/Running_the_App_Without_Docker.md isn't fully completed. It leaves out how to populate the database with defaults such as first user and static data. I've tried running python3 manage.py createsuperuser and it comes back with error's about "Table 'djano_content_type' already exists"

Any ideas?

@sailorbob134280
Copy link

Having a similar problem. I'm able to create superusers, but they aren't able to log in.

@NateTheSage
Copy link
Contributor

NateTheSage commented Jan 31, 2020

I happened to figure out what the issue was regarding my lack of database population, so hopefully this will work for you guys. (My initial issue was I had skipped a step regarding prod-entrypoint.sh in which you replace the /code/manage.py with what's in the Running without Docker wiki on accident, whoops!).

There's a step that is not mentioned in the wiki that involves modifying the settings.py in the base directory. You have to make it match your .env database information in order to get your database populated, otherwise you'll get an unclear error about not being able to connect to 'db'. I did python3 manage.py createsuperuser after I figured this out and it worked perfectly, login included.

You'll want to look for this location in settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.environ.get('MYSQL_DATABASE', 'openeats'),
        'USER': os.environ.get('MYSQL_USER', 'root'),
        'PASSWORD': os.environ.get('MYSQL_ROOT_PASSWORD', ''),
        'HOST': os.environ.get('MYSQL_HOST', 'db'),
        'PORT': os.environ.get('MYSQL_PORT', '3306'),
        'OPTIONS': {
            'charset': 'utf8mb4'
        },
        'TEST': {
            'NAME': os.environ.get('MYSQL_TEST_DATABASE', 'test_openeats')
        }
    }
}

The database can and should operate without those naughty root credentials there, so put in whatever you put in your .env. The next time you restart your API, the database should self-populate. If not, run it manually and kill your gunicorn process with a Control-C.

This was done on Debian 10 (in a very hacky fashion since Node 8 is not in support anymore). I'm going to see about getting the wiki steps modified to include this info, particularly steps on a more modern operating system, as I think the steps seem to think the user is on Debian 8, which is now oldoldstable.

@NateTheSage
Copy link
Contributor

There we are, pull request is in to include the new step. It's a bit hacky, but if someone wants to do it on Debian 10, it is in fact possible, with some elbow grease. 😅

RyanNoelk pushed a commit that referenced this issue Feb 3, 2020
This includes the missing step in #109 that I discovered and also updates the walkthrough to enable installing on a more modern (Debian 10) operating system.
@RyanNoelk
Copy link
Member

Thanks of taking the time to update the docs :)

Please feel free to create PRs that update these docs in the future. I run everything in a docker container so I'd never needed/updated these docs.

@NateTheSage
Copy link
Contributor

NateTheSage commented Feb 3, 2020

Not a problem! The only suggestion I can make is ensuring your Node is up to date. Getting that stuff to work when it's out of date and you're not a Node guru is an exercise in patience. 😜

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

4 participants