-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Default value is missing user/password/host information #320
Comments
@grondman Thanks to open a issue. Please follow the steps below to get it resolved. Please let me know if you have any more trouble. 1 - Install the dependencies inside the pip install -r requirements/local.txt 2 - Ensure that in your "everycheese/config/settings/base.py" contains this [1] content before the [1] https://gist.github.com/luzfcb/96515096c777b360d7b13aad2239fdec (the latest version of django-crash-starter already includes the content of the previous file.) 3 - On the root directory of your everycheese project, create a file named touch .env 4 - add the following configuration to the DATABASE_URL=postgres://myuser:mypasswd@localhost:5432/everycheese 5 - Edit the 6 - Run You should get this output: CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypasswd' CREATEDB;
CREATE DATABASE everycheese WITH ENCODING 'UTF-8' OWNER "myuser";
GRANT ALL PRIVILEGES ON DATABASE everycheese TO myuser;
On Linux: python manage.py sqlcreate | sudo -u postgres psql -U postgres On Mac:
TroubleshootingIf for some reason you get an error similar to this: ERROR: syntax error at or near "WITH"
LINE 1: CREATE USER WITH ENCRYPTED PASSWORD '' CREATEDB;
^
ERROR: zero-length delimited identifier at or near """"
LINE 1: CREATE DATABASE everycheese WITH ENCODING 'UTF-8' OWNER "";
^
ERROR: syntax error at or near ";"
LINE 1: GRANT ALL PRIVILEGES ON DATABASE everycheese TO ; Or ERROR: role "myuser" already exists
ERROR: database "everycheese" already exists
GRANT You can delete the database and the user with the commands below and then perform step 7 again.
On Linux: sudo -u postgres dropdb -U postgres --if-exists everycheese
sudo -u postgres dropuser -U postgres --if-exists myuser On Mac: dropdb --if-exists everycheese
dropuser --if-exists myuser |
This worked, thank you. |
tested this process on macOS Catalina (everycheese) hsautter@MacBook everycheese % touch .env |
Location within the Book
Description
Section 18.4 contains a snippet from
base.py
saying it should containpostgres://user:passwd@localhost:5432/everycheese
, but here I getpostgres:///everycheese
which actually seems to be correct when I look at the GitHub source code ofdjango-crash-starter
, as it contains the template"postgres:///{{cookiecutter.project_slug}}"
which is consistent with the user/password/host information missing...Possible Solutions
I don't know if this is something to fix in the book or in the
django-crash-starter
project?Your full name so we can provide accurate credit within the book
Ivo Grondman
The text was updated successfully, but these errors were encountered: