archweb icon indicating copy to clipboard operation
archweb copied to clipboard

Starting archweb

Open mfgbhatti opened this issue 2 years ago • 3 comments

Hey Awesome People, I am new to django, came across archweb. I tried installing it, the way it is on the readme. Believe me, it is not intended for beginners. I would love helping to make it simpler. But i have two hurdles to cross

  1. After installing memcached through pacman and running it as service by systemd on the main system and running ./manage.py collectstatic I do overcome, No file or directory error. But I am getting 404 on some of the static resources in production but even DEBUG=True not getting any log of these errors. But I am not getting this error as such on my local development in virtualbox machine. The setup is same dajango :8000 <-> nginx (proxy).
  2. I am not able to figure out any way to run django using gunicorn or uwsgi. I am using gunicorn -b 0.0.0.0:8000 archweb.wsgi and getting ModuleNotFoundError: No module named 'archweb'. I am not sure just just using searching it arround and trying different things. Thank you

mfgbhatti avatar Sep 08 '22 09:09 mfgbhatti

  1. Can you paste the full error from ./manage.py collecstatic ?
  2. Did you follow the readme? That explains setting up a virtualenv, memcached is not a hard requirement for local development. Setup virtualenv and make sure to source it and then ./manage.py runserver should work.

Do you want a development setup or run it in production?

jelly avatar Sep 13 '22 19:09 jelly

  1. Can you paste the full error from ./manage.py collecstatic ?

No there is no error.

  1. Did you follow the readme?

Yes. I followed readme. and ./manage.py runserver is working

Do you want a development setup or run it in production?

yes please. I am trying to use gunicorn below is the output. I want to run it through systemd in production. But not able to figure it out. I did pip install -r requirements_prod.txt for production

I am attaching some screen shots for the errors i am getting. I did try out using gunicorn in env and in system both failed. The screen shot with ./manage.py runserver is with debug true. but i am not able to get any info about these errors. Thank you in advance.

$ gunicorn -b 0.0.0.0:8000 archweb.wsgi:application
[2022-09-14 19:29:15 +0100] [651552] [INFO] Starting gunicorn 20.1.0
[2022-09-14 19:29:15 +0100] [651552] [INFO] Listening at: http://0.0.0.0:8000 (651552)
[2022-09-14 19:29:15 +0100] [651552] [INFO] Using worker: sync
[2022-09-14 19:29:15 +0100] [651553] [INFO] Booting worker with pid: 651553
[2022-09-14 19:29:15 +0100] [651553] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'archweb'
[2022-09-14 19:29:15 +0100] [651553] [INFO] Worker exiting (pid: 651553)
[2022-09-14 19:29:15 +0100] [651552] [INFO] Shutting down: Master
[2022-09-14 19:29:15 +0100] [651552] [INFO] Reason: Worker failed to boot.

Screenshot from 2022-09-14 19-28-32

Screenshot from 2022-09-14 19-28-55

mfgbhatti avatar Sep 14 '22 18:09 mfgbhatti

  1. Can you paste the full error from ./manage.py collecstatic ?

No there is no error.

Here it runs as:

(env) [jelle@t14s][~/projects/archweb]%./manage.py collectstatic

You have requested to collect static files at the destination
location as specified in your settings:

    /home/jelle/projects/archweb/collected_static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel:
  1. Did you follow the readme?

Yes. I followed readme. and ./manage.py runserver is working

Do you want a development setup or run it in production?

yes please. I am trying to use gunicorn below is the output. I want to run it through systemd in production. But not able to figure it out. I did pip install -r requirements_prod.txt for production

Ok, our production setup is not really documented, that's true. archlinux.org's setup is "documented" through ansible here:

https://gitlab.archlinux.org/archlinux/infrastructure/-/tree/master/roles/archweb

However we don't use gunicorn but use uwsgi but that shouldn't matter too much. What could be the reason your gunicorn can't find archweb is that the path to the venv (assuming you use a venv) is hardcoded here. The same for line 6 where the base_path is hardcoded. So you probably want to adjust these paths to your setup.

I am attaching some screen shots for the errors i am getting. I did try out using gunicorn in env and in system both failed. The screen shot with ./manage.py runserver is with debug true. but i am not able to get any info about these errors. Thank you in advance.

$ gunicorn -b 0.0.0.0:8000 archweb.wsgi:application
[2022-09-14 19:29:15 +0100] [651552] [INFO] Starting gunicorn 20.1.0
[2022-09-14 19:29:15 +0100] [651552] [INFO] Listening at: http://0.0.0.0:8000 (651552)
[2022-09-14 19:29:15 +0100] [651552] [INFO] Using worker: sync
[2022-09-14 19:29:15 +0100] [651553] [INFO] Booting worker with pid: 651553
[2022-09-14 19:29:15 +0100] [651553] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'archweb'
[2022-09-14 19:29:15 +0100] [651553] [INFO] Worker exiting (pid: 651553)
[2022-09-14 19:29:15 +0100] [651552] [INFO] Shutting down: Master
[2022-09-14 19:29:15 +0100] [651552] [INFO] Reason: Worker failed to boot.

Screenshot from 2022-09-14 19-28-32

Screenshot from 2022-09-14 19-28-55

jelly avatar Sep 15 '22 07:09 jelly

No response.

jelly avatar Mar 26 '23 10:03 jelly