django-ve / django-helloworld Goto Github PK
View Code? Open in Web Editor NEWA Django hello world example
A Django hello world example
Hi, I'm using your django hello-world app to experiment creating django apps in kubernetes. I am copying your steps into a Dockerfile and building it.
FROM debian
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y python3-dev python3-pip python3-virtualenv sqlitebrowser && rm -rf /var/lib/apt/lists/*
COPY requirements.txt /
RUN pip install -r requirements.txt
...
and I get an error when it's installing the requirements
...
=> ERROR [ 4/11] RUN pip install -r requirements.txt 0.6s
------
> [ 4/11] RUN pip install -r requirements.txt:
#0 0.520 error: externally-managed-environment
#0 0.520
#0 0.520 × This environment is externally managed
#0 0.520 ╰─> To install Python packages system-wide, try apt install
#0 0.520 python3-xyz, where xyz is the package you are trying to
#0 0.520 install.
#0 0.520
#0 0.520 If you wish to install a non-Debian-packaged Python package,
#0 0.520 create a virtual environment using python3 -m venv path/to/venv.
#0 0.520 Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
#0 0.520 sure you have python3-full installed.
#0 0.520
#0 0.520 If you wish to install a non-Debian packaged Python application,
#0 0.520 it may be easiest to use pipx install xyz, which will manage a
#0 0.520 virtual environment for you. Make sure you have pipx installed.
#0 0.520
#0 0.520 See /usr/share/doc/python3.11/README.venv for more information.
#0 0.520
#0 0.520 note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
#0 0.520 hint: See PEP 668 for the detailed specification.
------
Dockerfile:8
--------------------
6 | COPY requirements.txt /
7 |
8 | >>> RUN pip install -r requirements.txt
9 |
10 | RUN mkdir -p /docs
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
So I am thinking it's an error relating to the venv. My question is where is the python3-virtualenv getting used? Should I create a venv to the container before pip install?
No worries if you don't have time. I'll keep investigating and will post a reply if I find an answer.
Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 342, in execute self.check() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 374, in check include_deployment_checks=include_deployment_checks, File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks issues.extend(super(Command, self)._run_checks(**kwargs)) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 361, in _run_checks return checks.run_checks(**kwargs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/Users/robiulislam/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/robiulislam/personal/personal/urls.py", line 15, in <module> url(r'^polls/$', 'personal.views.polls'), File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/conf/urls/__init__.py", line 85, in url raise TypeError('view must be a callable or a list/tuple in the case of include().') TypeError: view must be a callable or a list/tuple in the case of include(). ROBIULs-MacBook-Pro:personal robiulislam$ cd ./hone -bash: cd: ./hone: No such file or directory ROBIULs-MacBook-Pro:personal robiulislam$ cd /home ROBIULs-MacBook-Pro:home robiulislam$ cd helloworld-master -bash: cd: helloworld-master: No such file or directory ROBIULs-MacBook-Pro:home robiulislam$ ls ROBIULs-MacBook-Pro:home robiulislam$ cd /Users/robiulislam/helloworld-master ROBIULs-MacBook-Pro:helloworld-master robiulislam$ python manage.py migrate \Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 342, in execute self.check() File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 374, in check include_deployment_checks=include_deployment_checks, File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks issues.extend(super(Command, self)._run_checks(**kwargs)) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/management/base.py", line 361, in _run_checks return checks.run_checks(**kwargs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/robiulislam/anaconda/lib/python3.6/site-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/Users/robiulislam/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/robiulislam/helloworld-master/helloworld/urls.py", line 3, in <module> from django.conf.urls import patterns, include ImportError: cannot import name 'patterns'
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.