Saturday, November 18, 2017

Re: How to Speed up Loading the First Page of Django Project?

Thank you for your reply. The first page always loads slowly while the rest of the pages loads at a normal speed. Whether I restart the apache or not doesn't affect the speed of loading the first page - always slow.

Below is the configuration file in the sites-available folder under apache. My apache is 2.4.
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Require all granted
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted
        </Directory>
ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Require all granted
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

Alias /static path/to/my/project/static
        <Directory path/to/my/project/static>
                Require all granted
        </Directory>

  <Directory path/to/my/project>
        <Files wsgi.py>
                Require all granted
        </Files>
        </Directory>


  WSGIDaemonProcess myproject python-path=path/to/my/project:path/to/my/project/lib/python2.7/site-packages
  WSGIProcessGroup myproject
  WSGIScriptAlias / path/to/my/project/myproject/wsgi.py
</VirtualHost>

Thank you!

在 2017年11月17日星期五 UTC-5上午8:27:24,Jason写道:
I would suggest you post the configuration file here as well as the server specifications and average CPU/memory usage.  Because what you're describing is definitely not normal and is most likely related to how Apache is configured.

A point of clarification: does the first page always load slowly, or is it just the first page after you restart the server?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4cb4d8a9-6709-4f89-923f-bf5cc311e05a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment