pip install locustio ==0.8a2 is not installing? - django

I got an issue on 'core' module in not find in django project. To overcome from this problem, i got to know that i have to install 'locustio ==0.8a2' so i type in windowshell
pip install locustio ==0.8a2
but it is not installing.
And here is the initial problem(django):
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Papul\Desktop\sandeep\myproject\myproject\urls.py", line 6, in <module>
from core.views import SignUpView
ModuleNotFoundError: No module named 'core'
here is the snapshot:[1] https://i.stack.imgur.com/00tGl.png [2]: https://i.stack.imgur.com/PXO5u.png

"No module named core", it looks like could not find your django package. please show "pip list ", by the way, why not use some IDE to run your project.(e.g. pycharm )

You should install locust package it's not locustio anymore:
Locust package has moved from 'locustio' to 'locust'. Please update your reference (or pin your version to 0.14.6 if you dont want to update to 1.0)
pip install locust

To resolve, install the missing modules:
pip install core
before you run
pip install locustio==0.8a2

Related

Fixtures are not working after Django squashmigrations

I just squashed a lot of migrations in Django 4.0.x.
Now when running the migrations I get the following error:
File "/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/Django-4.0.3-py3.9.egg/django/db/migrations/loader.py", line 120, in load_disk
migration_module = import_module(migration_path)
File "/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/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 846, in exec_module
File "<frozen importlib._bootstrap_external>", line 983, in get_code
File "<frozen importlib._bootstrap_external>", line 913, in source_to_code
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/runner/work/backend/backend/general/migrations/0001_squashed_0019_merge_0018_auto_20220226_2311_0018_auto_20220228_2343.py", line 42
code=general.migrations.0004_initial_general.Migration.load_data,
^
SyntaxError: invalid decimal literal
The according code lines in the migration file is:
migrations.RunPython(
code=general.migrations.0004_initial_general.Migration.load_data,
),
I am totally lost here.
As I could find in this link https://stackoverflow.com/a/59813844/17881270
Python identifiers can not start with a number.
Hope that could help you. Rename them in migration table and that directory and your squash.
Or maybe you can use getattr function.
Look at the top of your squashed migration file - you should find a comment that reads something like this:
# Functions from the following migrations need manual copying.
# Move them and any dependencies into this file, then update the
# RunPython operations to refer to the local versions:
# general.migrations.0004_initial_general
You should also have seen a notice printed to your console when you generated the migrations, alerting you that manual modification of the generated file is needed.
This is happening because you have defined some custom migration functions in that migration, which Django was not able to migrate automatically. You need to manually copy the load_data function from 0004_initial_general.py into this squashed migration file, and then replace the reference to it in the RunPython call.

syntax error when importing django-sphinxsearch

I am trying to run the standard django migration commands, ex., python3 manage.py makemigrations, and continuously get a syntax error on module import with sphinxsearch.
I know it's deprecated, but unfortunately I am working on small additions to the site and cannot move to elasticsearch yet.
Python version : 3.5.3
System : Debian (AWS server)
Sphinx version: 3.5.4
sphinxsearch version: 0.1
Error message:
Traceback (most recent call last):
File "manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 669, in exec_module
File "<frozen importlib._bootstrap_external>", line 775, in get_code
File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/usr/local/lib/python3.5/dist-packages/sphinxsearch/__init__.py", line 75
SPH_ATTR_MULTI = 0X40000000L
^
SyntaxError: invalid syntax
I've tried updating the system and have changed sphinx version, but I received the same error, just referencing a different file. Please note that the ini.py file is showing as blank when I navigate to it manually.
The error is caused by the trailing L in SPH_ATTR_MULTI = 0X40000000L and this is a sign that this code is meant to work with python 2, not python 3. In python 2 the trailing L is a indication that the value is type long instead integer and it is used for large numbers, but in python 3 integer and long were unified, so the trailing L is giving an SyntaxError.
Use python 2.7 if sphinx is absolutely necessary.
I was able to remove the sphinxsearch module as it wasn't necessary, install the sphinx 4.0 release.
That gave me a context error with "str = f'{item}'" format, so I changed it to "str = "% ..." % (item)" format manually within base.py ( in /usr/local/lib/python3.5/dist-packages/sphinxsearch/base.py) and it worked properly with python 3.5
It seems its just that a weird mid-tier version is necessary.

No moudle named roocket

hello guys i have a problem with a tutorial which im seeing since qurantine has started and i really need a big help into solving it.
story is i lost some of my files or accidently deleted them , so i used the files for the project which they have into zipfiles but for this projects i keep getting this error while im trying to run local server this is the error after using py manage.py makemigrations
(( its a big error so i just copied end of it ))
File "c:\users\navid\appdata\local\programs\python\python38-32\lib\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 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 'roocket'```
i think it must be something with bootstrap so i started to see if bootstrap is installed or not and the results for the project directory are:
`asgiref==3.2.7
astroid==2.3.3
beautifulsoup4==4.9.0
colorama==0.4.3
Django==3.0.5
django-bootstrap4==1.1.1
django-jalali==3.3.0
django-jalali-date==0.3.1
isort==4.3.21
jdatetime==3.6.2
lazy-object-proxy==1.4.3
mccabe==0.6.1
psycopg2==2.8.5
pylint==2.4.4
pytz==2019.3
six==1.14.0
soupsieve==2.0
sqlparse==0.3.1
wrapt==1.11.2`

Can do longer load packages django

Historically, I was able to easily install packages on my app, but after installing Heroku and whitenoise, soemthing broke. I tried to rebuild the app, virtualvenv from scratch, according to best conventions, but nothing fixes it. Now, any package I try to install I get this error. The packages successfully install, but when I try to run the application, I get a the following error:
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'settings'
This seems to be a common problem discuss in a lot of groups, but I have not found any solutions. I've been working on this all day. Please help. New to django.
https://groups.google.com/forum/#!topic/django-users/0tAtr4NBJ_4 http://www.techlighting.info/django-channels-tutorial-1-creating-a-chat-application/
I think that my project is not connecting to the packages correctly.
Here is my file relationship.
This is where the project is:
Documents > Projects > hosproject > catalog, manage.py, hosproject2, venv
This is where the packages are
Documents > trydjango > lib >python3.7>site.packages>packages
Here is my istalled app:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'catalog',
'import-export', #this breaks when I try to install today
'django_tables2', # this I installed hsitorically ( a month ago and works)
#'csvimport.app.CSVImportConf', # this breaks it
]
Basically any package will break it if I try an install now. Packages that I installed historically work.
I think it has to do with my path and wgsi:
I've tried to play around with this setting it to different things, but cannot set it correctly where it works. This is my last attempt.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")

Pip package a django project

The target is to create a pip package of a Django project.
The goal is to make the web application quickly installable anywhere just by doing pip install.
The use cases are 2 that I can think of:
Manually start the application using a console_scripts like client-web-up that should be the equivalent to type manage.py runserver.
This is what I'm focused on right now.
create some sort of script to generate configuration files for apache, nginx etc... for later.
Steps taken
Created a main folder client_web for my pip package.
Moved all my project into client_web folder.
Created a setup.py as shown below.
Edited manage.py file so its content can be executed by an function named entry().
Publish the pip package which downloads and installs correctly.
from setuptools import setup
setup(
name="client-web",
...,
version="2018.08.03.3",
packages=[
"client_web",
"client_web.controller",
"client_web.measurement",
"client_web.webapp",
"client_web.controller.migrations",
"client_web.measurement.migrations",
],
include_package_data=True,
install_requires=[
...
],
entry_points={
"console_scripts": [
"client-web-up=client_web.manage:entry"
]
}
)
The problem
If i type the following in the terminal:
$ client-web-up
Traceback (most recent call last):
File "/usr/local/bin/client-web-up", line 26, in <module>
sys.exit(entry())
File "/usr/local/lib/python3.7/site-packages/client_web/manage.py", line 33, in entry
main();
File "/usr/local/lib/python3.7/site-packages/client_web/manage.py", line 30, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 377, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 352, in execute
django.setup()
File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'webapp'
But if I do:
$ pip3 show client-web
Name: client-web
Version: 2018.8.3.3
Location: /usr/local/lib/python3.7/site-packages
Requires: ...
Required-by: ...
$ python3 /usr/local/lib/python3.7/site-packages/client_web/manage.py
Available subcommands:
[auth]
changepassword
createsuperuser
[contenttypes]
remove_stale_contenttypes
[django]
...
Could someone help me find a way to make the console_script work?
solved by adding a sys.path like so:
sys.path.append(os.path.dirname(os.path.realpath(__file__)))