Run django project on new computer

I developed a project on django for years and deployed it on heroku.

Now my Computer crashed and i try to get my running django project from heroku run on my new laptop in pycharm.

-i cloned my project from heroku -installed all dependencies -created new venv -set system variables secret key etc...

seems like i have multiple issues...

tried everything and read for hours and days but cant get it working ....

any tip would be usefull

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\schno\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
    self.run()
  File "C:\Users\schno\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\core\management\base.py", line 419, in check
    all_issues = checks.run_checks(
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\urls\resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\urls\resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\urls\resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\schno\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\django_proj\urls.py", line 34, in <module>
    path('', include('angebot.urls', namespace='angebot')),#view funktionsaufruf der in angebot app in views.py erstellt wurde
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\venv\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\schno\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\angebot\urls.py", line 17, in <module>
    path('<int:id>/pdf/', angebot_views.generate_pdf, name='angebot_pdf'),
AttributeError: module 'angebot.views' has no attribute 'generate_pdf'

dependencies:

arabic-reshaper==2.1.1
asgiref==3.6.0
boto3==1.26.34
botocore==1.29.34
cairocffi==1.2.0
CairoSVG==2.5.1
certifi==2020.12.5
cffi==1.14.4
chardet==4.0.0
cleanup==1.0.3
cryptography==3.4.6
cssselect2==0.4.1
defusedxml==0.6.0
diff-match-patch==20200713
dj-database-url==0.5.0
Django==3.2.16
django-allauth==0.44.0
django-crispy-forms==1.10.0
django-extensions==3.1.1
django-heroku==0.3.1
django-import-export==2.6.1
django-storages==1.13.1
django-weasyprint==1.1.0
docopt==0.6.2
et-xmlfile==1.1.0
future==0.18.2
gunicorn==20.0.4
html5lib==1.1
huepy==1.2.1
idna==2.10
jmespath==1.0.1
MarkupPy==1.14
oauthlib==3.1.0
odfpy==1.4.1
openpyxl==3.0.9
Pillow==9.4.0
psycopg2==2.8.6
pycparser==2.20
PyJWT==2.0.1
pyOpenSSL==20.0.1
PyPDF2==1.26.0
Pyphen==0.10.0
python-bidi==0.4.2
python-dateutil==2.8.2
python-form==0.2.3
python3-openid==3.2.0
pytz==2020.5
PyYAML==6.0
reportlab==3.6.12
requests==2.25.1
requests-oauthlib==1.3.0
s3transfer==0.6.0
six==1.15.0
social-auth-app-django==3.1.0
social-auth-core==4.1.0
sqlparse==0.4.1
tablib==3.0.0
tinycss2==1.1.0
typing_extensions==4.4.0
ua-parser==0.10.0
urllib3==1.26.4
user-agents==2.2.0
webencodings==0.5.1
Werkzeug==1.0.1
whitenoise==5.2.0
xlrd==2.0.1
xlwt==1.3.0
  File "C:\Users\schno\PycharmProjects\ers-heatscreen-app\angebot\urls.py", line 17, in <module>
    path('<int:id>/pdf/', angebot_views.generate_pdf, name='angebot_pdf'),
AttributeError: module 'angebot.views' has no attribute 'generate_pdf'

Read above carefully. In your urls.py one usually assigns paths to view functions. Therefore angebot_views.generate_pdf has to be a view function. But this can not be imported. Check the top of the urls.py file how you're importing angebot_views. Your code somehow relates that to angebot.views. Check that view file, if that view function generate_pdf is indeed there.

After confirming the existence of this view function and its correct importing you search further.

Since you said you did not change anything and simply copied the entire project my next thought would be about changed import paths. Remember that imports kind of depend from where the process was launched. Have you changed the location of your manage.py file (Since that is the file 'starting' your project)?

The error is not within the dependencies but about a view function that can not be found. You have to find it and import and assign it properly within your angebot/urls.py

Back to Top