cookiecutter-django | Cookiecutter Django is a framework
kandi X-RAY | cookiecutter-django Summary
kandi X-RAY | cookiecutter-django Summary
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cookiecutter-django
cookiecutter-django Key Features
cookiecutter-django Examples and Code Snippets
$ pip install "cookiecutter>=1.7.0"
$ cookiecutter https://github.com/Jean-Zombie/cookiecutter-django-wagtail/
Cloning into 'cookiecutter-django'...
remote: Counting objects: 550, done.
remote: Compressing objects: 100% (310/310), done.
remote:
# install the latest stable version of dokku
wget https://raw.githubusercontent.com/dokku/dokku/v0.12.10/bootstrap.sh;
sudo DOKKU_TAG=v0.12.10 bash bootstrap.sh
# Once the installation is complete, you can open a browser to setup your SSH key and vi
$ cookiecutter https://github.com/phalt/cookiecutter-django-api.git
project_name (default is 'project_name'):
cd project_name
make install
make build
make serve
pip install --no-cache-dir --no-index --no-deps --find-links=/wheels/ /wheels/*
$ python -m pip install Something
$ # instead of 'pip install Something'
$ python3 -m pip install Something
$ # instead of 'pip3 install Something'
EMAIL_BACKEND = env(
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend"
)
EMAIL_HOST = "smtp.gmail.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "your_email@gmail.com"
EMAIL_HOST_PASSWORD = "email_password"
DEFAULT
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
image: travel_production_postgres
volumes:
- local_postgres_data:/var/lib/postgresql/data
- local_postgres_data_backups:
def blog_index(request):
posts = Post.objects.all().order_by("-created_on")
context = {
"posts" : posts,
}
return render(request, "blog_index.html", context)`
def blog_index(request):
posts = Post.objects.all()
python /app/manage.py compress --force
python /app/manage.py collectstatic --noinput
python /app/manage.py compress --force
/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
# Requirements are installed here to ensure they will be cached.
RUN pip3 install --upgrade pip
RUN pip3 install pipenv
COPY Pipfile* /app/
RUN cd /app && pipenv install
Community Discussions
Trending Discussions on cookiecutter-django
QUESTION
I am using a Django Project Template from here. I am testing my serializers and permission in every viewset my app has. I want to use parametrize from pytest to reduce the lines I need to write tests to each serializers and viewset. I have 10 serializers and viewset that I need to test which has a pattern as shown bellow.
test_drf_viewsets.py
...ANSWER
Answered 2022-Feb-23 at 02:17I found a minimal solution that works for my use case.
Instead of using these:
QUESTION
I am starting a project with cookiecutter-django with docker deployment, for some reason traefik can't get letsencrypt certificate, this is the error:
...ANSWER
Answered 2022-Jan-29 at 15:49Are your AAAA records correct?
Seems Let's Encrypt is getting a 204 back on the challenge files. The usual error is having AAAA records going to different servers than A records and traefik only serving challenge files on the A record servers.
QUESTION
I'm using Caprover with Docker to run a Django project (Django-Cookiecutter) which is non persistent. I'm also running a persistent app on the same server which imports csv data. I need the two apps to basically share a file together. This is how i imagined it:
- The importer app imports csv data and stores it as a json file inside a specific folder.
- The Django app accesses the json file in that folder and uses a script i wrote to import the json into the database. I'm struggling to understand how i can access the folder inside my importer app containing the json file from my django app. Does anyone have an idea on how i can make this happen between those two docker containers?
ANSWER
Answered 2022-Jan-11 at 21:46You can share a directory or file between the two containers by mounting the same directory in both containers. Here's a simple docker-compose example where two containers mount the same directory. Then the first container writes to a file and the second container reads from it.
ExampleQUESTION
Context
In my Django project (based on Django cookiecutter) I use django-graphql-auth
which depends on django-graphql-jwt
.
I forked django-graphql-jwt
to make some changes so then also forked django-graphql-auth
to update its dependency to my django-graphql-jwt
fork:
ANSWER
Answered 2021-Dec-23 at 12:43Assuming all required dependencies were built in the first step (with pip wheel
), you could ignore dependencies in the installation step by adding the --no-deps
option to pip install
:
QUESTION
I’m sure this is pretty straightforward to someone experienced. I’m learning Django through the Wedge of Django ebook.
I’m using Python 3.8.7 installed via pyenv like so:
pyenv install 3.8.7
Then I’ve set up a virtualenv like so:
pyenv virtualenv 3.8.7 everycheese
I activate the virtualenv in my repo like so:
pyenv local everycheese
The environment is shown as active in the prompt, as it starts with (everycheese).
The main project is cloned from Django Cookiecutter https://github.com/cookiecutter/cookiecutter-django
I’ve then used pip to install requirements from the requirements.txt files.
However - I’m running into trouble when I try to add new packages (by adding the package to requirements.txt as a new line and installing again with pip).
pip list
, or pip freeze
both show the new module. But when I add the module to my INSTALLED_APPS and try to import it in my models.py file, Django cannot find it.
When I type
which python
, and which pip
, they point to different directories and I think this may be part of the problem but I am stuck.
ANSWER
Answered 2021-Dec-20 at 08:38When using pip
(or actually any other Python script), it is important to make sure which Python interpreter is used. Usually it is obvious which Python interpreter is used when calling pip
. But sometimes it is not clear, and the script is actually running with a different interpreter that one might think. Which leads to unexpected results and a lot of confusion.
Therefore it is always better to call explicitly the exact Python interpreter you are targeting and tell it to run pip's executable module (or any other executable module). Typically:
QUESTION
Cookiecutter-django have endpoints /auth-token/ to get a token and /api/users/me/ for getting user info. But it does not seem to have a logout endpoint. Am I right?
And, if the serverside logout is needed, i will need to write it.
Can you confirm? Thanks.
...ANSWER
Answered 2021-May-03 at 18:58It looks like you are referring to the DRF part of the cookie cutter. There is no logout, what you want to do is write some endpoint that will delete/invalidate the instance of the respective Token
model from your database.
If you are referring to the non-DRF part, there is a logout at /accounts/logout/
.
QUESTION
How does running docker-compose -f local.yml up
create the postgres database in the postgres container with configurations in .envs/.local/.postgres
. I have looked through the Dockerfiles and cannot seem to find a command such as createdb
except in the maintenance/restore
file.
Cookiecutter-django: https://github.com/pydanny/cookiecutter-django
...ANSWER
Answered 2021-May-03 at 18:53The cookie cutter sets the environment variables which are then read by the Docker image. See Section How to extend this image > Environment Variables in the official docs: https://hub.docker.com/_/postgres
QUESTION
I recently updated a django api from 2.2 to 3.1. I updated the dockerfile and related bash files like django-cookiecutter did https://github.com/pydanny/cookiecutter-django/commit/b22045bcd4ebf563ccdcf226fb389a6bb71e2654#diff-1872e6a6f0bbcb27f2eda185ac89eed05eb7a402b298e58bcbef29bf039c2c13
The upgrade mostly went well except now in production we cannot send email. I have a minimal management command I run in production to test email settings
...ANSWER
Answered 2021-Apr-04 at 14:06So in short, it's very likely your mail server only supports TLS 1.1 or even only TLS 1.0 and the slim-buster image no longer has support for those protocols.
Going back to 3.7-alpine (which is known working combination) or an older ubuntu/debian version which still supports those protocols will allow you to send mail again.
Then you should upgrade your mail server, cause both TLS 1.0 and TLS 1.1 should have died long ago.
Edit:
Another way to test your mailserver is to use openssl's s_client
command:
QUESTION
Can anyone help me with to configure my django cookiecutter production setup to work with Gmail SMTP.
I have deployed my application using docker. Cookiecutter gives you to configure your app to anymail providers. I've chosen Mailgun however I didn't have an email address that has been verified by my domain provider. So, I couldn't register any user to my app because ( https://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html#configuring-the-stack) here it says you can't :)
I have tried to override the default email verification setting from "mandatory" to "none". However, it still threw 500. In below, I've added all-auth settings. I had to decide either to buy an email address or configure my app to work with Gmail Smtp or get rid of this email verification process.
settings/base.py
...ANSWER
Answered 2020-Nov-09 at 07:57You don't config email host and email from the sender. Try this
QUESTION
We're applying Black code style to a django project.
In all the tutorials / examples I find (such as in django cookiecutter and this blog), I keep seeing django's migrations files excluded from the linter.
But to my mind, these are still python files. Sure, django may not autogenerate them to meet the Black spec. But it's not like developers always write their code to meet Black spec... that's what linting is for!
Why would migration files be considered different to any other python files?!
NB I'm aware of the possibility of changing an already-applied migration if you've got pre-existing migrations - this requires care on first application (as does first application to the rest of the codebase, frankly) but surely isn't a reason not to do it?
EDIT - @torxed asked for an example of a django migration file
I'm not sure how helpful this'll be tbh, but a typical django migration file might look like this (in this case adding a char field to a table):
...ANSWER
Answered 2020-Jul-10 at 18:18You should rarely if ever, need to edit migration files. Because of that, it makes sense to exclude from the already agreed upon code layout of the files.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cookiecutter-django
No Installation instructions are available at this moment for cookiecutter-django.Refer to component home page for details.
Support
If you have any questions vist the community on GitHub, Stack Overflow.
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page