feldroy / django-crash-starter Goto Github PK
View Code? Open in Web Editor NEWThe Cookiecutter template for the Django Crash Course tutorial by Daniel and Audrey Feldroy.
Home Page: https://www.feldroy.com/products/django-crash-course
The Cookiecutter template for the Django Crash Course tutorial by Daniel and Audrey Feldroy.
Home Page: https://www.feldroy.com/products/django-crash-course
Entered value that wasn't EveryCheese
, it defaulted to everycheese
for the slug.
The other value should have been slugified.
P. 98 of TwoScoops Django 3/Python 3.8 book
When running python manage.py migrate
, encountered the following error (traceback):
Traceback (most recent call last): File "manage.py", line 34, in <module> execute_from_command_line(sys.argv) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute django.setup() File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'debug_toolbar'
Should have gone off without a hitch.
Follow all steps in Chapter 18 up to this point.
run:
conda install django-debug-toolbar
installing the above with pip appears not to work.
Results in different error:
Traceback (most recent call last): File "manage.py", line 34, in <module> execute_from_command_line(sys.argv) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute django.setup() File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/Users/mgbvox/opt/anaconda3/envs/django/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'django_extensions'
condo installing django-extensions then allowed migrate to run.
Not sure what the underlying issue is here. But I do know the instructions in the book don't apply.
Dependabot can't evaluate your Python dependency files.
As a result, Dependabot couldn't check whether any of your dependencies are out-of-date.
The error Dependabot encountered was:
Illformed requirement ["==1.1.1."]
The starting README should have more than just a TODO.
Leaving TODOs in committed code is a deprecated practice. Issues are the standard way of filing TODOs.
By leaving the TODO in, we risk causing lots of Django projects to be created out in the wild with TODOs in their READMEs.
I hacked the django-crash-starter cookiecutter for deployment to Heroku (I removed anymail, caches and logging). The github repo is here: And I got it up and running(). I ran heroku run python manage.py check --deploy -a <app-name>
and got this:
?: (security.W022) You have not set the SECURE_REFERRER_POLICY setting. Without this, your site will not send a Referrer-Policy header. You should consider enabling this header to protect user privacy.
It should have passed the checks
run python manage.py check --deploy
I got an error message on pylint:
Suspicious state from syntax checker python-pylint: Flycheck checker python-pylint returned 1, but its output contained no errors: Traceback (most recent call last):
File "/Users/soloidx/.venvs/everycheese/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/Users/soloidx/.venvs/everycheese/lib/python3.8/site-packages/pylint/__init__.py", line 22, in run_pylint
PylintRun(sys.argv[1:])
File "/Users/soloidx/.venvs/everycheese/lib/python3.8/site-packages/pylint/lint/run.py", line 303, in __init__
linter.load_plugin_modules(plugins)
File "/Users/soloidx/.venvs/everycheese/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 498, in load_plugin_modules
module = modutils.load_module_from_name(modname)
File "/Users/soloidx/.venvs/everycheese/lib/python3.8/site-packages/astroid/modutils.py", line 203, in load_module_from_name
return load_module_from_modpath(dotted_name.split("."), path, use_sys)
File "/Users/soloidx/.venvs/everycheese/lib/python3.8/site-packages/astroid/modutils.py", line 244, in load_module_from_modpath
mp_file, mp_filename, mp_desc = imp.find_module(part, path)
File "/Users/soloidx/.pyenv/versions/3.8.1/lib/python3.8/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'pylint_celery'
I assume that it is because in .pylintrc
is configured to use the pylint_celery plugin but is not listen inside the requirements/local
Should pass smoothly
cookiecutter gh:feldroy/django-crash-starter
[creating a venv and enabling it]
pip install pylint
pylint
Dependabot can't evaluate your Python dependency files.
As a result, Dependabot couldn't check whether any of your dependencies are out-of-date.
The error Dependabot encountered was:
Illformed requirement ["==1.1.1."]
Not very friendly when trying to deploy
These fields should have sane defaults or useful instructions:
False
as most users won't set up S3The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
Related documentation:
https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/
https://docs.github.com/en/github/administering-a-repository/enabling-and-disabling-version-updates
https://docs.github.com/en/github/administering-a-repository/customizing-dependency-updates
We need to keep tracking the dependencies update
I am on windows 10
The environment is miniconda as in the django-crash-course book.
After running the coverage run -m pytest
Test session starts (platform: win32, Python 3.8.2, pytest 5.3.5, pytest-sugar 0.9.2)
django: settings: config.settings.test (from option)
rootdir: C:\Users\Rahul\AppData\Roaming\plrplus\fastest\django-tests\everycheese, inifile: pytest.ini
plugins: django-test-plus-1.4.0, django-3.9.0, sugar-0.9.2
collecting ...
everycheese/users/tests/test_forms.py ✓ 11% █▎
everycheese/users/tests/test_models.py ✓ 22% ██▎
everycheese/users/tests/test_urls.py ✓ 33% ███▍
everycheese/users/tests/test_urls.py ✓✓ 44% ████▌
everycheese/users/tests/test_urls.py ✓✓✓ 56% █████▋
everycheese/users/tests/test_views.py ✓ 67% ██████▋
everycheese/users/tests/test_views.py ✓✓ 78% ███████▊
everycheese/users/tests/test_views.py ✓✓✓ 89% ████████▉
everycheese/users/tests/test_views.py ✓✓✓✓ 100% ██████████
Results (1.74s):
9 passed
after running coverage report
No data to report.
That is inconsistent with what is in the book.
I smelled something fishy. I then opened .coveragerc
[run]
include = everycheese/*
omit = *migrations*, *tests*
plugins =
django_coverage_plugin
That seems ok.
for testing, I just deleted the file.
running above codes after deleting .coveragerc file gave.
-------------------------------------------------------------------------------------------
config\__init__.py 0 0 100%
config\settings\__init__.py 0 0 100%
config\settings\base.py 58 1 98%
config\settings\test.py 8 0 100%
config\urls.py 12 4 67%
everycheese\__init__.py 2 0 100%
everycheese\conftest.py 13 0 100%
everycheese\contrib\__init__.py 0 0 100%
everycheese\contrib\sites\__init__.py 0 0 100%
everycheese\contrib\sites\migrations\0001_initial.py 6 0 100%
everycheese\contrib\sites\migrations\0002_alter_domain_unique.py 5 0 100%
everycheese\contrib\sites\migrations\0003_set_site_domain_and_name.py 11 4 64%
everycheese\contrib\sites\migrations\__init__.py 0 0 100%
everycheese\users\__init__.py 0 0 100%
everycheese\users\admin.py 12 0 100%
everycheese\users\apps.py 10 0 100%
everycheese\users\forms.py 18 0 100%
everycheese\users\migrations\0001_initial.py 8 0 100%
everycheese\users\migrations\0002_user_bio.py 4 0 100%
everycheese\users\migrations\__init__.py 0 0 100%
everycheese\users\models.py 9 0 100%
everycheese\users\tests\__init__.py 0 0 100%
everycheese\users\tests\factories.py 14 0 100%
everycheese\users\tests\test_forms.py 15 0 100%
everycheese\users\tests\test_models.py 5 0 100%
everycheese\users\tests\test_urls.py 13 0 100%
everycheese\users\tests\test_views.py 40 0 100%
everycheese\users\urls.py 4 0 100%
everycheese\users\views.py 23 0 100%
-------------------------------------------------------------------------------------------
TOTAL 290 9 97%
Not what exactly in the book but acceptable compared to no data to report
Am I missing something, or this is due to buggy windows as always?
For the repo, not the rendered project
UserUpdateView.form_valid()
has two uncovered lines.
These should be tested accurately
coverage run -m pytest
coverage report
coverage html
Check htmlcov/index.html
Convert to the standard Django name as generated by startproject
.
Matches the Django nomenclature in startproject
.
35 Wiring in the List View Url
Where in the everycheese/cheeses/urls.py does it state that the views.CheeseListView.as_view() will be wired to cheese_list.html
?
Just curiosity
For instance, I have changed cheese_list.html
file name to cheese_array.html
and path(..., name=array)
and it won't work. I would like to know
Setup preferably with GitHub actions to work on Linux, Mac, and Windows. But we can get by on just Linux.
With Cookiecutters It's easy to break the build and not know about it. The answer is CI. It would be great if this could be done via GitHub actions.
Add a badge so we know for certain it's working at all times.
When running cookiecutter gh:feldroy/django-crash-starter
, a directory everycheese/
is created inside of the current working directory, containing all the code for the EveryCheese project.
Is it possible to create all the code in the current working directory?
I'm using PyCharm with pipenv and it already creates a project directory with the virtual environment so I do not need an extra subdirectory inside of the working directory.
I'd like to do something similar to
django-admin startproject project_name .
In the programming world, Markdown is becoming much more standard than RST.
Markdown is more user-friendly and familiar to devs coming from non-Python backgrounds.
How do I change default language of 3rd party django apps?
I've installed django-countries as instructed and it shows the country list in Korean.
I don't remember setting language in particular and yet, for some reason, it shows in such manner.
Same for the allauth apps (some of the headers are in Korean as well such as 'Log out').
Section 19.4 header reads ..GitLab.. when it clearly should be GitHub (or whatever preferred case).
albert@chelsea ~/.cookiecutters/django-crash-starter/{{cookiecutter.project_slug}}/requirements (master)
$ git diff local.txt
diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt
index e29a544e..74174c78 100644
--- a/{{cookiecutter.project_slug}}/requirements/local.txt
+++ b/{{cookiecutter.project_slug}}/requirements/local.txt
@@ -2,7 +2,7 @@
Werkzeug==1.0.1 # https://github.com/pallets/werkzeug
ipdb==0.13.2 # https://github.com/gotcha/ipdb
-{%- if cookiecutter.windows == 'n' -%}
+{%- if cookiecutter.windows == 'n' %}
psycopg2-binary==2.8.5 # https://github.com/psycopg/psycopg2
{%- endif %}
Am having the following this error.
Am trying to build an online shop using the cookiecutter.
python manage.py runserver
Watching for file changes with StatReloader
INFO 2020-08-23 11:55:13,654 autoreload 13959 139651660433216 Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
all_issues = self._run_checks(
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/core/management/base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/urls/resolvers.py", line 407, in check
for pattern in self.url_patterns:
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/urls/resolvers.py", line 588, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/urls/resolvers.py", line 581, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/reus/Documents/WORK/elimubora/config/urls.py", line 28, in
path('cart/', include('elimubora.cart.urls',namespace='cart')),
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/reus/Documents/WORK/elimubora/elimubora/cart/urls.py", line 2, in
from . import views
File "/home/reus/Documents/WORK/elimubora/elimubora/cart/views.py", line 4, in
from elimubora.cart.cart import Cart
File "/home/reus/Documents/WORK/elimubora/elimubora/cart/cart.py", line 3, in
from shop.models import Book
File "/home/reus/Documents/WORK/elimubora/elimubora/shop/models.py", line 4, in
class Category(models.Model):
File "/home/reus/Documents/WORK/env/lib/python3.8/site-packages/django/db/models/base.py", line 112, in new
raise RuntimeError(
RuntimeError: Model class shop.models.Category doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
My apps look like this:
DJANGO_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.staticfiles",
# "django.contrib.humanize", # Handy template tags
"django.contrib.admin",
"django.forms",
]
THIRD_PARTY_APPS = [
"crispy_forms",
"allauth",
"allauth.account",
"allauth.socialaccount",
]
LOCAL_APPS = [
"elimubora.users.apps.UsersConfig",
"elimubora.shop.apps.ShopConfig",
"elimubora.cart.apps.CartConfig",
"elimubora.orders.apps.OrdersConfig",
# Your stuff: custom apps go here
]
When I execute python manage.py runserver
I got the following traceback:
File "/home/edvm/Code/edvm/python/cookiecutter/frula/config/settings/base.py", line 48, in <module>
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
NameError: name 'os' is not defined
(django3)
Also BASE_DIR
is missing (same file). After defining (locally) this variables, i get: ModuleNotFoundError: No module named 'debug_toolbar'
I installed debug_toolbar
with: pip install django-debug-toolbar
, then django_extensions
is misisng. I pip install django_extensions
and finally get it working.
It should execute runserver without errors.
pd: I didn't send a PR as this issues are really small, but if you want and consider its ok, i can send a pr :)
1- Create a new virtualenv, activate it.
2- Install cookiecutter
3- Clone this repo, create a project with: cookiecutter django-crash-starter
, set sqlite
as DB
4- cd project_dir and: pip install -r requirements.txt
, then execute: python manage.py runserver
.
Installed the dependencies as described in 18.6
pip install -r requirements/local.txt
then I ran migrate
now the error occurs
psycopg2.OperationalError: fe_sendauth: no password supplied
In other projects, we auto-generate a default project_slug from project_name. Let's do this here.
To help newbies reduce the risk of errors from un-importable project slugs that they accidentally use.
A newbie accidentally sets project_slug
to Every Cheese
which is neither importable nor Pythonic (should be lowercase with underscores).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.